code: func (o *CacheOptions) WrapBackend(c context.Context, base backend.B) context.Context {
  	return backend.WithFactory(c, func(c context.Context) backend.B {
  		// Start with our base Backend.
  		be := base
  
  		// If our datastore cache is available, fetch settings to see if it's
  		// enabled.
  		if o.DatastoreCacheAvailable {
  			switch s, err := gaeconfig.FetchCachedSettings(c); err {
  			case nil:
  				// Successfully fetched settings, is our datastore cache enabled?
  				switch s.DatastoreCacheMode {
  				case gaeconfig.DSCacheEnabled:
  					// Datastore cache is enabled, do we have an expiration configured?
  					exp := time.Duration(s.CacheExpirationSec) * time.Second
  					if exp > 0 {
  						// The cache enabled enable. Install it into our backend.
  						locker := &dsCacheLocker{}
  						dsCfg := datastore.Config{
  							RefreshInterval: exp,
  							LockerFunc:      func(context.Context) datastorecache.Locker { return locker },
  						}
  						be = dsCfg.Backend(be)
  					}
  				}
  
  			default:
  				log.WithError(err).Warningf(c, "Failed to fetch datastore cache settings.")
  			}
  		}
  
  		// Add a proccache-based config cache.
  		if o.CacheExpiration > 0 {
  			be = caching.LRUBackend(be, messageCache.LRU(c), o.CacheExpiration)
  		}
  
  		return be
  	})
  }
docs: // WrapBackend wraps the supplied base backend in caching layers and returns a
  // Context with the resulting backend installed.