Conversation
|
@RelicOfTesla Hi 👋 |
| } | ||
|
|
||
| // WithKeepTTL is the expiration time to keep existing keys when calling Set. By default, it is replaced by the new time or never expires. | ||
| func WithKeepTTL(_keep ...bool) ItemOption { |
There was a problem hiding this comment.
Is this better?
| func WithKeepTTL(_keep ...bool) ItemOption { | |
| func WithKeepTTL(keep bool) ItemOption { |
There was a problem hiding this comment.
Both are feasible, but I prefer to input less code because function names already have a certain intention
| got, _ := nc.Cache.Get(key) | ||
| nv := got + n | ||
| nc.Cache.Set(key, nv) | ||
| nc.Cache.Set(key, nv, WithKeepTTL()) |
There was a problem hiding this comment.
We do not intend to make destructive changes to this library to ensure backward compatibility unless there is a good reason to do so. Why is this change necessary? Please provide a clear reason.
There was a problem hiding this comment.
The default rules for redis/memcached and more cache libraries... We do not recommend using different designs to avoid thinking burdens
Support KeepTTL option when update cache value.
Fix Increment/Decrement lose expiration time.