示例#1
0
文件: catalog.go 项目: HYQMartin/star
func NAllIds() []int64 {
	val := g.NCatalogCacheGet("ids")
	if val == nil {
		if ids := NAllIdsInDB(); len(ids) != 0 {
			g.NCatalogCachePut("ids", ids)
			return ids
		} else {
			return []int64{}
		}
	}

	return val.([]int64)
}
示例#2
0
文件: catalog.go 项目: HYQMartin/star
func NIdByIdent(ident string) int64 {
	if ident == "" {
		return 0
	}

	val := g.NCatalogCacheGet(ident)
	if val == nil {
		if cp := NOneByIdentInDB(ident); cp != nil {
			g.NCatalogCachePut(ident, cp.Id)
			return cp.Id
		} else {
			return 0
		}
	}

	return val.(int64)
}
示例#3
0
文件: catalog.go 项目: HYQMartin/star
func NOneById(id int64) *NewemployeeCatalog {
	if id == 0 {
		return nil
	}

	key := fmt.Sprintf("%d", id)
	val := g.NCatalogCacheGet(key)
	if val == nil {
		if cp := NOneByIdInDB(id); cp != nil {
			g.NCatalogCachePut(key, *cp)
			return cp
		} else {
			return nil
		}
	}
	ret := val.(NewemployeeCatalog)
	return &ret
}