gotoolkit/cache/options.go
2025-03-23 23:37:26 +01:00

14 lines
223 B
Go

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
}
}