-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Added a generic LRUCache interface and a default implementation #311
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@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 :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please address
{ | ||
var cache = new LruCache<List<string>>(0, LruCache<object>.DEFAULT_TIMEOUT_SECONDS); | ||
|
||
cache.Save("user1", _segments1And2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have some questions.
OptimizelySDK/Odp/LruCache.cs
Outdated
_logger = logger ?? new DefaultLogger(); | ||
|
||
_cache = | ||
new Dictionary<string, (LinkedListNode<string> node, ItemWrapper value)>(_maxSize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am just curious can't we just take LinkedListNode as value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
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