Enabling native ttl option for metastore #92

Open
wants to merge 1 commit into
from

Projects

None yet

2 participants

@mje113
mje113 commented Oct 28, 2013

If an EntityStore for a given entry was purged at the cache level--due to its native ttl--the corresponding MetaStore entry should be allowed to be purged as well.

@grosser grosser commented on the diff Oct 8, 2015
lib/rack/cache/metastore.rb
@@ -80,7 +80,11 @@ def store(request, response, entity_store)
headers.delete 'Age'
entries.unshift [stored_env, headers]
- write key, entries
+ if request.env['rack-cache.use_native_ttl']
@grosser
grosser Oct 8, 2015 collaborator

test for this ?

@grosser grosser commented on the diff Oct 8, 2015
test/metastore_test.rb
@@ -251,6 +251,12 @@ def purge(*args); nil end
@store.read(key).length.should.equal 2
end
+
+ it 'takes a ttl parameter for #write' do
+ @store.write('/test', [[{},{}],[{},{}]], 0)
+ tuples = @store.read('/test')
+ tuples.should.equal [ [{},{}], [{},{}] ]
@grosser
grosser Oct 8, 2015 collaborator

needs to be .must_equal (switched to minitest)

@grosser
Collaborator
grosser commented Oct 8, 2015

can we use a constant for the string ?

@grosser
Collaborator
grosser commented Oct 8, 2015

best also include mezis@ceb675d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment