Use default time if none set, use 0 to set no timeout (just like memcached) #20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I added a default time to live of 5 minutes.
If a user wants no time to live then you can send a time value of 0 (this is how memcached does it).
If part of your application is not setting the optional time argument but another part of the application is then when the cache gets full only the items with times are considered for eviction. The result is you are not really evicting by recency, simply due to one dev leaving off an optional param and the other deciding to use it.
I believe having to explicitly set an item as forever ttl is better behavior (this is how memcached does it).
Tests added and all existing still pass.