feat: Added a generic LRUCache interface and a default implementation#311
Conversation
|
@jaeopt Would you like for this Pull Request to also wait for @msohailhussain 's approval? |
Yes for all PRs. Unfortunately, I cannot cover csharp lang stuffs :) |
| { | ||
| var cache = new LruCache<List<string>>(0, LruCache<object>.DEFAULT_TIMEOUT_SECONDS); | ||
|
|
||
| cache.Save("user1", _segments1And2); |
There was a problem hiding this comment.
Is this possible if we can return true or false. @jaeopt a question for you?
|
@msohailhussain Can you take a look at this Pull Request and the suggested LRU implementation when you have a chance? |
msohailhussain
left a comment
There was a problem hiding this comment.
have some questions.
| _logger = logger ?? new DefaultLogger(); | ||
|
|
||
| _cache = | ||
| new Dictionary<string, (LinkedListNode<string> node, ItemWrapper value)>(_maxSize); |
There was a problem hiding this comment.
Am just curious can't we just take LinkedListNode as value?
There was a problem hiding this comment.
I think the idea is to pop off both the node from the Tuple and put it in the _list & back in the _cache along with the item see linw 150ish.
Let's talk through this too.
|
@msohailhussain This is ready for another review after our conversation. |
Summary
Added an interface for a LRU Caching mechanism using generics. Include a default implementation.
Test plan
Included new tests in the test project
Issues
OASIS-8407