Open rajatjindal opened 8 years ago
it passes the expires_in option to the backend ... https://github.com/grosser/cachy/blob/master/lib/cachy.rb#L29 ...https://github.com/grosser/cachy/blob/master/lib/cachy/moneta_wrapper.rb#L6 so nothing it can do after that point if the backend does not support it ... maybe the backend needs a differently named option ... check the moneta spec / see if you can get it to work by directly using moneta and then somehow make a PR for cachy ...
I noticed the same thing :expires_in
doesn't expire with the Memory store. I got the expiration to work by setting the timeout when I'm creating the Moneta store but its a global expiration (global behaviour was ok for my use case, but an individual :expires_in
option would be better):
Moneta.new(:LRUHash, expires: 30)
It seems like Cachy does not expire the cache even after timeout (or may be I am using it incorrectly).
Look at this test that I added to existing tests for Cachy using Moneta cache store which is failing.
https://github.com/rajatjindal83/cachy/commit/8f1bde65d32088eae2e54036578f3f1b3163d185
Your feedback will be highly appreciated.
It fails as follows:
C02PRUQFG8WP:cachy rjindal$ rake rspec spec/ ...............F.........................................*.................
Pending: Cachy key_versions merges in old when setting new
!!!!!
Failures:
1) Cachy::MonetaWrapper expires on timeout Failure/Error: Cachy.cache(:timeout_key) { 'newkey' }.should_not == 'original' expected not: == "original" got: "original"
./spec/cachy/moneta_wrapper_spec.rb:63:in `block (2 levels) in <top (required)>'
Finished in 3.14 seconds 75 examples, 1 failure, 1 pending
Failed examples:
rspec ./spec/cachy/moneta_wrapper_spec.rb:60 # Cachy::MonetaWrapper expires on timeout