| 123 | } |
| 124 | |
| 125 | func newFrontendCache(cacheProvider cache.Provider, role cache.Role, logger log.Logger) *frontendCache { |
| 126 | var c cache.Cache |
| 127 | if cacheProvider != nil { |
| 128 | c = cacheProvider.CacheFor(role) |
| 129 | } |
| 130 | |
| 131 | level.Info(logger).Log("msg", "init frontend cache", "role", role, "enabled", c != nil) |
| 132 | |
| 133 | if c == nil { |
| 134 | return nil |
| 135 | } |
| 136 | |
| 137 | return &frontendCache{ |
| 138 | c: c, |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | // store stores the response body in the cache. the caller assumes the responsibility of closing the response body |
| 143 | func (c *frontendCache) store(ctx context.Context, key string, buffer []byte) { |