tests: cache
This commit is contained in:
parent
92732f9682
commit
597feb7b54
8 changed files with 822 additions and 32 deletions
14
cache/options.go
vendored
Normal file
14
cache/options.go
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
package cache
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.nakama.town/fmartingr/gotoolkit/model"
|
||||
)
|
||||
|
||||
func WithTTL(ttl time.Duration) model.CacheOption {
|
||||
return func(item *model.CacheItem) {
|
||||
exp := time.Now().Add(ttl)
|
||||
item.TTL = &exp
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue