store stores the response body in the cache. the caller assumes the responsibility of closing the response body
(ctx context.Context, key string, buffer []byte)
| 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) { |
| 144 | if c.c == nil { |
| 145 | return |
| 146 | } |
| 147 | |
| 148 | if key == "" { |
| 149 | return |
| 150 | } |
| 151 | |
| 152 | if len(buffer) == 0 { |
| 153 | return |
| 154 | } |
| 155 | |
| 156 | c.c.Store(ctx, []string{key}, [][]byte{buffer}) |
| 157 | } |
| 158 | |
| 159 | // fetch fetches the response body from the cache. the caller assumes the responsibility of closing the response body. |
| 160 | func (c *frontendCache) fetchBytes(ctx context.Context, key string) []byte { |