feat: cache
This commit is contained in:
parent
ef80892aa5
commit
5cdbbd2296
3 changed files with 148 additions and 0 deletions
18
model/cache.go
Normal file
18
model/cache.go
Normal file
|
@ -0,0 +1,18 @@
|
|||
package model
|
||||
|
||||
import (
|
||||
"errors"
|
||||
)
|
||||
|
||||
var ErrCacheKeyDontExist = errors.New("cache key don't exist")
|
||||
|
||||
type Cache interface {
|
||||
Get(key string) (any, error)
|
||||
GetWithOptions(key string, opts ...CacheGetOption)
|
||||
Set(key string, value any) error
|
||||
SetWithOptions(key string, value any, opts ...CacheSetOption)
|
||||
Delete(key string) error
|
||||
}
|
||||
|
||||
type CacheGetOption func()
|
||||
type CacheSetOption func()
|
Loading…
Add table
Add a link
Reference in a new issue