// doRetrieve will retrieve the real data from database, redis, apis, etc.
doRetrieve will retrieve the real data from database, redis, apis, etc.
// doRetrieve will retrieve the real data from database redis apis etc .
func (c *BaseCache) doRetrieve(k cache.Key) (interface{}, error) {
	key := k.Key()
	value, err, _ := c.g.Do(key, func() (interface{}, error) {
		return c.retrieveFunc(k)
	})
	if err != nil {
		c.backend.Set(key, EmptyCache{err: err}, EmptyCacheExpiration)
		return nil, err
	}
	c.backend.Set(key, value, 0)
	return value, nil
}
func ( c * BaseCache ) doRetrieve ( k cache . Key ) ( interface { } , error ) { key := k . Key ( ) value , err , _ := c . g . Do ( key , func ( ) ( interface { } , error ) { return c . retrieveFunc ( k ) } ) if err != nil { c . backend . Set ( key , EmptyCache { err : err } , EmptyCacheExpiration ) return nil , err } c . backend . Set ( key , value , 0 ) return value , nil }
doRetrieve will retrieve the real data from database, redis, apis, etc.
doRetrieve will retrieve the real data from database redis apis etc .
// 3.2 fetch // ! if error, cache it too, make it short enough(5s) // 4. set value to cache, use default expiration