func (c *BaseCache) Get(key cache.Key) (interface{}, error) {
	// 1. if cache is disabled, fetch and return
	if c.disabled {
		value, err := c.retrieveFunc(key)
		if err != nil {
			return nil, err
		}
		return value, nil
	}

	k := key.Key()

	// 2. get from cache
	value, ok := c.backend.Get(k)
	if ok {
		// if retrieve fail from retrieveFunc
		if emptyCache, isEmptyCache := value.(EmptyCache); isEmptyCache {
			return nil, emptyCache.err
		}
		return value, nil
	}

	// 3. if not exists in cache, retrieve it
	return c.doRetrieve(key)
}
// Get will get the key from cache, if missing, will call the retrieveFunc to get the data, add to cache, then return
Get will get the key from cache, if missing, will call the retrieveFunc to get the data, add to cache, then return
// Get will get the key from cache if missing will call the retrieveFunc to get the data add to cache then return
func (c *BaseCache) Get(key cache.Key) (interface{}, error) {
	if c.disabled {
		value, err := c.retrieveFunc(key)
		if err != nil {
			return nil, err
		}
		return value, nil
	}
	k := key.Key()
	value, ok := c.backend.Get(k)
	if ok {
		if emptyCache, isEmptyCache := value.(EmptyCache); isEmptyCache {
			return nil, emptyCache.err
		}
		return value, nil
	}
	return c.doRetrieve(key)
}
func ( c * BaseCache ) Get ( key cache . Key ) ( interface { } , error ) { if c . disabled { value , err := c . retrieveFunc ( key ) if err != nil { return nil , err } return value , nil } k := key . Key ( ) value , ok := c . backend . Get ( k ) if ok { if emptyCache , isEmptyCache := value . ( EmptyCache ) ; isEmptyCache { return nil , emptyCache . err } return value , nil } return c . doRetrieve ( key ) }
Get will get the key from cache, if missing, will call the retrieveFunc to get the data, add to cache, then return
Get will get the key from cache if missing will call the retrieveFunc to get the data add to cache then return
// 1. if cache is disabled, fetch and return // 2. get from cache // if retrieve fail from retrieveFunc // 3. if not exists in cache, retrieve it