Closed izturn closed 10 months ago
I think adding "sliding caching" will not hit performance. but seems it requires to add extra 4/8 bytes (int32/int64) to record time.Duration
, it will hit the memory efficient. Let me consider...
Maybe we could considering to decrease the TTL accuracy to seconds level (uint32), then adding the sliding will also requires another uint32(even uint16).
Another option is, just fork/copy this LRU codes to your project then modify easily -- That's is the initial motivation of this library. 😄
BTW: to simplify the repo codes, I remove bench tests and merge its code to readme and workflow yaml.
so, which option is you prefer?
let me try option 1, hopefully nobody won't unhappy with the TTL accuracy decreasing.
I added sliding cache support in master branch by introduce a method *Cache.SlidingGet(key)
, please help check
I added sliding cache support in master branch by introduce a method
*Cache.SlidingGet(key)
, please help check1. hope this implementation is correct, without any misunderstandings. 2. could please give advice/suggestion about the method naming? "SildingGet" seems not good enough. 3. I'm still considering do accuracy decreasing by ttl/expires from int64 -> int32
bard
, it seems that the all cache implemention's Get
will be sliding, maybe touchGet
?TouchGet
and add a new method TouchGetOrLoad
i think we can delay/match the Range
to spec: add range over int, range over func.
btw, how about a clear
?
I reverted Range method.
And for Clear
, I afraid that it will introduce data race or user misunderstood/misuse, so I have no good idea to add/implement it.
Please allow me close this issue.
Welcome to raise new issues for feature request/ideas, thanks again!
Thanks for share the nice repo, I have just added the
Loader
to my code, the new version makes it outdated ;-), the last feature I'm missing is sliding caching, now the cache is absolute TTL, shall we add it?