gin-cache icon indicating copy to clipboard operation
gin-cache copied to clipboard

feat: Option to extend cache time on cache hit

Open l3uddz opened this issue 2 years ago • 1 comments

Hi,

Thanks for this package, works nicely.

Would it be possible to get an Option to extend the cache duration on a cache hit?

Thanks

l3uddz avatar Mar 07 '22 08:03 l3uddz

This feature is more appropriate to implement in CacheStore.

For local memory cache store, ttlcache support to extend the cache duration on cache hit. But the default constructor disable the feature, You can open it yourself. https://github.com/chenyahui/gin-cache/blob/main/persist/memory.go#L22

For redis cache store, I will add a cache hit option for this demands later ~

chenyahui avatar Mar 07 '22 11:03 chenyahui