golang-lru icon indicating copy to clipboard operation
golang-lru copied to clipboard

Add method GetAndAdd to LRU Cache

Open vasayxtx opened this issue 4 years ago • 5 comments

Hi, Sometimes it's useful to get value by key and set a new one atomically (like getset in the Redis).

vasayxtx avatar Dec 27 '20 18:12 vasayxtx

CLA assistant check
All committers have signed the CLA.

hashicorp-cla avatar Dec 27 '20 18:12 hashicorp-cla

This needs to be reworked against the locking/eviction changes that were just merged. But will be happy to have it after!

jefferai avatar Jan 04 '21 14:01 jefferai

@jefferai ok, done. Please review.

vasayxtx avatar Jan 05 '21 11:01 vasayxtx

One comment -- looks good otherwise. Let me know if you agree with that proposal.

Yes, you are right, fixed.

vasayxtx avatar Jan 05 '21 17:01 vasayxtx

@jefferai could you please review and merge if all is ok?

vasayxtx avatar Jan 20 '21 17:01 vasayxtx