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

Expirable entries

erwanor opened this issue · comments

Hi,

Do you plan to add, in the near future, support for expirable entries?

e.g:

expiration := time.Now().Add(24 * time.Hour) // Now + 24h
gc := gcache.New(10).LRU().Build()
gc.Set("key", "value", expiration)

If you don't, would you be interested in a PR that extends the current implementation to support that feature?

Hi, @aaronwinter

Yes, I'm interested in it.
But if include the suggested features, I would like to separate from the Set method.
For example, how about implementing it in the SetWithExpire method?

@bluele Thanks for the quick reply. Agreed on the design decision, that's what I had in mind too.