You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Check if the key exists in the cache var value []byte err = h.Group.Get(nil, k, groupcache.AllocatingByteSliceSink(&value)) if err == nil { // Key exists in the cache, compare with the new value if !reflect.DeepEqual(value, v) { // Values are different, update the cache jsonValue, err := json.Marshal(v) if err != nil { return err } expireTime := time.Now().Add(time.Duration(h.cacheTTL) * time.Minute) err = h.Group.Set(context.Background(), k, jsonValue, expireTime, false) if err != nil { return err } } }
Can you update a key's value directly? Or have to delete the key first, then set "key: new value"?
The text was updated successfully, but these errors were encountered: