bluele / gcache

An in-memory cache library for golang. It supports multiple eviction policies: LRU, LFU, ARC

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

size based expiry?

nergdron opened this issue · comments

I know this is probably a pretty big feature req, but it looks like the current implementation works based on the number of objects in the cache. It would be extremely useful to have a size based cache, which didn't care about the number of objects, but would start expiring things after a specified memory capacity was exceeded.

@nergdron
I am sorry for late reply.
I don't have any plans to support size based cache at this point in time.
You might want to use unsafe.SizeOf method to estimate the number of objects.