Move utils into shared folder
This commit is contained in:
parent
500bf48295
commit
c25f27e82e
22 changed files with 111 additions and 137 deletions
9
storage/cache/cache.go
vendored
9
storage/cache/cache.go
vendored
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue