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

add Values() method to get cache values

Open DoubleDi opened this issue 4 years ago • 1 comments

Hi @jefferai !

All the current cache implementations export the Keys() method which returns all the keys in the cache.

In some cases, like cache testing, you need to know all the cache values. You can do this via Keys() + Get() operation, but this is not an atomic operation.

So I present Values() which returns all the cache values in a similar way to Keys(). Please consider adding this method to the caches.

DoubleDi avatar Aug 22 '21 14:08 DoubleDi

CLA assistant check
All committers have signed the CLA.

hashicorp-cla avatar Aug 22 '21 14:08 hashicorp-cla

Thanks for this!

jefferai avatar Jun 06 '23 18:06 jefferai