Move utils into shared folder

This commit is contained in:
Melody Becker 2025-04-05 12:21:44 +02:00
parent 500bf48295
commit c25f27e82e
Signed by: mstar
SSH key fingerprint: SHA256:vkXfS9FG2pVNVfvDrzd1VW9n8VJzqqdKQGljxxX8uK8
22 changed files with 111 additions and 137 deletions

View file

@ -12,8 +12,9 @@ import (
ristretto_store "github.com/eko/gocache/store/ristretto/v4"
"github.com/redis/go-redis/v9"
"github.com/rs/zerolog/log"
"git.mstar.dev/mstar/linstrom/config"
"git.mstar.dev/mstar/linstrom/util"
"git.mstar.dev/mstar/linstrom/shared"
)
type Cache struct {
@ -73,7 +74,7 @@ func NewCache(maxSize int64, redisUrl *string) (*Cache, error) {
}
func (c *Cache) Get(key string, target any) (bool, error) {
defer util.Untrace(util.Trace(&log.Logger))
defer shared.Untrace(shared.Trace(&log.Logger))
return false, nil
data, err := c.cache.Get(ctxBackground, key)
if err != nil {
@ -87,7 +88,7 @@ func (c *Cache) Get(key string, target any) (bool, error) {
}
func (c *Cache) Set(key string, value any) error {
defer util.Untrace(util.Trace(&log.Logger))
defer shared.Untrace(shared.Trace(&log.Logger))
return nil
data, err := c.encoders.Encode(value)
if err != nil {
@ -98,7 +99,7 @@ func (c *Cache) Set(key string, value any) error {
}
func (c *Cache) Delete(key string) {
defer util.Untrace(util.Trace(&log.Logger))
defer shared.Untrace(shared.Trace(&log.Logger))
// Error return doesn't matter here. Delete is delete is gone
_ = c.cache.Delete(ctxBackground, key)
}