feat: cache

This commit is contained in:
Felipe M 2025-03-23 20:59:57 +01:00
parent ef80892aa5
commit 5cdbbd2296
Signed by: fmartingr
GPG key ID: CCFBC5637D4000A8
3 changed files with 148 additions and 0 deletions

18
model/cache.go Normal file
View 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()