From 488793a2dc5631db00bfbbd6d59128d8c2774682 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 29 Mar 2025 13:39:29 +0800 Subject: [PATCH] :bug: Trying to fix cache sdk issue --- pkg/nex/cachekit/io.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/nex/cachekit/io.go b/pkg/nex/cachekit/io.go index 1cce0d7..a4d741a 100644 --- a/pkg/nex/cachekit/io.go +++ b/pkg/nex/cachekit/io.go @@ -21,8 +21,8 @@ func Set[T any](c *CaConn, key string, value T, ttl time.Duration, tags ...strin ctx, cancel := c.withTimeout() defer cancel() - cm := cache.New[[]byte](c.GoCache()) - return cm.Set(ctx, key, raw, store.WithTags(tags), store.WithExpiration(ttl)) + cm := cache.New[string](c.GoCache()) + return cm.Set(ctx, key, string(raw), store.WithTags(tags), store.WithExpiration(ttl)) } // SetKA stands for Set Keep Alive @@ -35,8 +35,8 @@ func SetKA[T any](c *CaConn, key string, value T, tags ...string) error { ctx, cancel := c.withTimeout() defer cancel() - cm := cache.New[[]byte](c.GoCache()) - return cm.Set(ctx, key, raw, store.WithTags(tags)) + cm := cache.New[string](c.GoCache()) + return cm.Set(ctx, key, string(raw), store.WithTags(tags)) } func Get[T any](c *CaConn, key string) (T, error) { @@ -44,13 +44,13 @@ func Get[T any](c *CaConn, key string) (T, error) { ctx, cancel := c.withTimeout() defer cancel() - cm := cache.New[[]byte](c.GoCache()) + cm := cache.New[string](c.GoCache()) raw, err := cm.Get(ctx, key) if err != nil { return out, err } - if err := json.Unmarshal(raw, &out); err != nil { + if err := json.Unmarshal([]byte(raw), &out); err != nil { return out, fmt.Errorf("unable to unmarshal value during caching: %v", err) }