Beispiel #1
0
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)
}
Beispiel #2
0
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)
}
Beispiel #3
0
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
}