Skip to content
This repository has been archived by the owner on Nov 21, 2017. It is now read-only.

Commit

Permalink
Adjust expiring offset with invalid tags (:race_condition_ttl option …
Browse files Browse the repository at this point in the history
…doesn't work if (Time.now - expires_at) > race_condition_ttl)
  • Loading branch information
antage committed Nov 10, 2010
1 parent 099f654 commit 92d1c07
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -2,4 +2,4 @@ source "http://rubygems.org"
gemspec

gem "autotest", ">= 4.0.0"
gem "rspec", :git => "git://github.com/rspec/rspec"
gem "rspec", ">= 2.0.0"
4 changes: 4 additions & 0 deletions History.txt
@@ -1,3 +1,7 @@
=== 1.1.1 2010-11-10

* Adjust expiring offset with invalid tags (:race_condition_ttl option doesn't work if (Time.now - expires_at) > race_condition_ttl).

=== 1.1.0 2010-11-02

* TaggedCache supports ActionController#caches_action now.
Expand Down
4 changes: 2 additions & 2 deletions lib/active_support/cache/tagged_store.rb
@@ -1,4 +1,4 @@
require "active_support/core_ext/integer/time"
require "active_support/time"
require "active_support/core_ext/hash/except"

module ActiveSupport
Expand Down Expand Up @@ -142,7 +142,7 @@ def read_entry(key, options)
if entry.respond_to?(:depends) && entry.depends && !entry.depends.empty?
tags = read_tags(*entry.depends.keys)
valid = entry.depends.all? { |k, v| tags[k] == v }
entry.expires_at = (entry.created_at - 1.year) unless valid
entry.expires_at = 1.second.ago unless valid
end
entry
end
Expand Down
2 changes: 1 addition & 1 deletion tagged-cache.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "tagged-cache"
s.version = "1.1.0"
s.version = "1.1.1"
s.platform = Gem::Platform::RUBY
s.summary = "ActiveSupport cache adapter with tagged dependencies"
s.authors = ["Anton Ageev"]
Expand Down

0 comments on commit 92d1c07

Please sign in to comment.