karlseguin / ccache

A golang LRU Cache for high concurrency
MIT License
1.27k stars 118 forks source link

How to promote directly saved item? #68

Closed devrodriguez closed 1 year ago

devrodriguez commented 2 years ago

I dude, I need hight availability and Im thinking about to promote items just when it's saved, it's that posible?. I don't want to wait for get first item calls to promote it.

karlseguin commented 2 years ago

When an item is added (through set/replace/fetch), it's automatically promoted.

If you're asking for a special method, like c.Promote(key) I think you can just do:

_ = c.Get(key)

I don't think there's really be any way to have a dedicate Promote function be more optimized.

Or do I misunderstand your request?