Cache is a common abstraction to cache bytes. It is safe for concurrent use.
| 9 | |
| 10 | // Cache is a common abstraction to cache bytes. It is safe for concurrent use. |
| 11 | type Cache interface { |
| 12 | // Put stores the value under the key. Any existing value is overwritten. If |
| 13 | // ttl is given, the cache automatically forgets the value after the |
| 14 | // duration. If ttl is zero then it is never automatically forgotten. |
| 15 | Put(ctx context.Context, key string, value []byte, ttl time.Duration) error |
| 16 | |
| 17 | // Get returns the value stored under the key and its remaining ttl. If |
| 18 | // there is no value stored, ErrNotFound is returned. If the ttl is zero, |
| 19 | // the value does not automatically expire. Unless an error is returned, the |
| 20 | // value is always non-nil. |
| 21 | Get(ctx context.Context, key string) (value []byte, ttl time.Duration, _ error) |
| 22 | |
| 23 | // Forget removes the value stored under the key. No error is returned if |
| 24 | // there is no value stored. |
| 25 | Forget(ctx context.Context, key string) error |
| 26 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…