feat: cache + paths (#1)

- Added helper function `ExpandUser`
- Added basic cache impmentations for in-memory and file based caches.

Reviewed-on: #1
Co-authored-by: Felipe M. <me@fmartingr.com>
Co-committed-by: Felipe M. <me@fmartingr.com>
This commit is contained in:
Felipe M 2025-03-23 23:46:28 +01:00 committed by Felipe M
parent ef80892aa5
commit 98eb17d9f3
10 changed files with 984 additions and 0 deletions

14
cache/options.go vendored Normal file
View 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
}
}