func NIdByIdent(ident string) int64 { if ident == "" { return 0 } val := g.NBlogCacheGet(ident) if val == nil { if p := NOneByIdentInDB(ident); p != nil { g.NBlogCachePut(ident, p.Id) return p.Id } else { return 0 } } return val.(int64) }
func NReadBlogContent(b *NewemployeeBlog) *NewemployeeBlogContent { if b.Id <= 0 || b.BlogContentId <= 0 { return nil } key := fmt.Sprintf("content_of_%d_%d", b.Id, b.BlogContentLastUpdate) val := g.NBlogCacheGet(key) if val == nil { if p := NreadBlogContentInDB(b); p != nil { g.NBlogCachePut(key, *p) return p } return nil } ret := val.(NewemployeeBlogContent) return &ret }
func NOneById(id int64) *NewemployeeBlog { if id <= 0 { return nil } key := fmt.Sprintf("%d", id) val := g.NBlogCacheGet(key) if val == nil { if p := NOneByIdInDB(id); p != nil { g.NBlogCachePut(key, *p) return p } return nil } ret := val.(NewemployeeBlog) return &ret }
func NIds(catalog_id int64) []int64 { if catalog_id <= 0 { return []int64{} } key := fmt.Sprintf("article_ids_of_%d", catalog_id) val := g.NBlogCacheGet(key) if val == nil { if ids := NIdsInDB(catalog_id); len(ids) != 0 { g.NBlogCachePut(key, ids) return ids } else { return []int64{} } } return val.([]int64) }