Update item with same expiry#42
Update item with same expiry#42pranjal5215 wants to merge 5 commits intopatrickmn:masterfrom goibibo:updateItem
Conversation
|
I'm a little confused about this. Is the Update() method intended to keep the same expiration time as the original item? In that case, can't it just re-use the previous item's Expiration value? |
|
While setting item in cache set() in needed internally and Set() in called externally, now here the expiry to be set is new expiry time which would be x =[time which was set earlier - now ] Set() calculates expiry as e = time.Now().Add(d).UnixNano() Hence the use case. |
|
Found this fork: https://github.com/arp242/zcache |
Hi patrickmn,
We wanted to use in memory (fast) cache in golang to collect items from a running stream and use the item at the end of expiration as collected over time, approach we were using before was to create a cache and keep a channel ticking on time.After() on each key which went memory hungry, so using approach with go-cache where items expire after every X duration.
As such wanted to update item in cache with same expiry as original. So added function to do so ...
would be happy to merge with upstream ...