Closed Seberius closed 9 years ago
So sorry about those typos
Regarding 1.8, I agree, we should do a version bump and simply remove all 1.8 behaviour from the repo, people needing 1.8 can use the old gem.
Nice to see the shift fix is in, that code sure was crusty.
Hello,
Thanks!
As discussed in #3 , this is a general improvement branch to ease the implementation of a TTL cache.
First some notes about 1.8 support.
#key?
), so using it over 0.8.4 would not offer a benefit to a Ruby 1.8 user.Now on to the branch features
Ruby 2.1+ Performance Improvement
Ruby 2.1 appears to have resolved the performance issue reported in https://bugs.ruby-lang.org/issues/8312. We can get some significant improvement by using
#shift
in Ruby 2.1+. Please refer to the changes made to README.md for benchmark results (both ran on the same machine).Threadsafe Cache Refactor
The ThreadSafeCache implementation has been refactored as mixin, namely LruRedux::Util::SafeSync. The mixin will be compatible with the TTL cache, which cuts down on maintenance overhead.
New Cache Methods
A new cache method
#key?
and its alias#has_key?
have been added. This is method is equivalent toHash#key?
and is common in other cache implementations (e.g. clojure.core.cache). This method was also added to a LruRedux fork by @AlexSc, but never pull requested back.A new alias of
#delete
called#evict
has been added. This is equivalent to the#evict
method proposed in #3 and is common in other cache implementations (e.g. clojure.core.cache).Tests have been updated to cover the new method.
Typos in changelog
FIxed a couple typos in the changelog.
Tests
This branch is currently passing all tests on 1.8.7-p375, 2.0.0-p643, 2.2.0, jruby-1.7.19 and jruby-9.0.0.0-pre1.