2021-05-13 11:49:38 +00:00
|
|
|
package cache
|
|
|
|
|
2021-05-14 18:21:13 +00:00
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"time"
|
|
|
|
)
|
2021-05-13 11:49:38 +00:00
|
|
|
|
2021-05-27 19:30:52 +00:00
|
|
|
var ErrNotFound = errors.New("key doesn't exist in cache")
|
2021-05-13 11:49:38 +00:00
|
|
|
|
|
|
|
type Cache interface {
|
|
|
|
Store(key string, value interface{}) error
|
2021-05-14 18:21:13 +00:00
|
|
|
StoreWithTTL(key string, value interface{}, ttl time.Duration) error
|
2021-05-13 11:49:38 +00:00
|
|
|
Get(key string, value interface{}) error
|
|
|
|
Delete(key string)
|
2021-08-24 19:36:42 +00:00
|
|
|
Keys() []string
|
2021-07-26 21:18:16 +00:00
|
|
|
Exists(key string) bool
|
2021-05-13 11:49:38 +00:00
|
|
|
}
|