rails-cache-tags 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rails-cache-tags.rb +31 -28
- data/lib/rails/cache/tags/store.rb +5 -10
- data/lib/rails/cache/tags/version.rb +1 -1
- metadata +25 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8dbeafaeb77ad8bf678216ab5394736222e516e
|
4
|
+
data.tar.gz: ff7fd4145f49196921987c8a3822b4b19f5cb7a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efe9e5258b6f846832daac2ba26df2754e1ea8b1251d4ad0256bf0fcf7a685082f65a32239d5b04f9fc390a336b4f56405f64465d06f5ee167a233feed569489
|
7
|
+
data.tar.gz: ac90ec2a280d85e0e07498909e5aaedd441afcb6867ccf771bb3ff78b05a9fc870feba10fc18bd4da5a1a9919876e47519470bef75da52bcbcde911160b33e01
|
data/lib/rails-cache-tags.rb
CHANGED
@@ -1,44 +1,47 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
require 'active_support'
|
3
|
+
require 'active_support/concern'
|
2
4
|
require 'active_support/cache'
|
3
|
-
|
4
5
|
require 'rails/cache/tags/store'
|
5
6
|
|
6
|
-
module
|
7
|
+
module Rails
|
7
8
|
module Cache
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
module Tags
|
10
|
+
module Extensions
|
11
|
+
module ActiveSupportCache
|
12
|
+
extend ActiveSupport::Concern
|
13
|
+
|
14
|
+
included do
|
15
|
+
class << self
|
16
|
+
alias_method :old_lookup_store, :lookup_store
|
17
|
+
|
18
|
+
def lookup_store(*store_option)
|
19
|
+
store = old_lookup_store(*store_option)
|
20
|
+
store.class.send :include, Rails::Cache::Tags::Store
|
21
|
+
|
22
|
+
store
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
11
27
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
# ignore
|
28
|
+
module ActiveSupportCacheEntry
|
29
|
+
extend ActiveSupport::Concern
|
30
|
+
|
31
|
+
included do
|
32
|
+
attr_accessor :tags
|
33
|
+
end
|
19
34
|
end
|
20
35
|
end
|
21
36
|
end
|
22
37
|
end
|
23
38
|
end
|
24
39
|
|
25
|
-
|
40
|
+
::ActiveSupport::Cache::Entry.send :include, ::Rails::Cache::Tags::Extensions::ActiveSupportCacheEntry
|
41
|
+
::ActiveSupport::Cache.send :include, ::Rails::Cache::Tags::Extensions::ActiveSupportCache
|
42
|
+
|
26
43
|
ActiveSupport.on_load(:action_controller) do
|
27
44
|
require 'rails/cache/tags/action_controller'
|
28
45
|
|
29
|
-
ActionController::Base.send(:include, Rails::Cache::Tags::ActionController)
|
30
|
-
end
|
31
|
-
|
32
|
-
# Patch Dalli store
|
33
|
-
begin
|
34
|
-
require 'dalli'
|
35
|
-
require 'dalli/version'
|
36
|
-
|
37
|
-
if Dalli::VERSION.to_f > 2
|
38
|
-
require 'active_support/cache/dalli_store'
|
39
|
-
|
40
|
-
ActiveSupport::Cache::DalliStore.send(:include, Rails::Cache::Tags::Store)
|
41
|
-
end
|
42
|
-
rescue LoadError, NameError
|
43
|
-
# ignore
|
46
|
+
::ActionController::Base.send(:include, Rails::Cache::Tags::ActionController)
|
44
47
|
end
|
@@ -13,7 +13,6 @@ module Rails
|
|
13
13
|
extend ActiveSupport::Concern
|
14
14
|
|
15
15
|
included do
|
16
|
-
alias_method_chain :initialize, :tags
|
17
16
|
alias_method_chain :exist?, :tags
|
18
17
|
alias_method_chain :read, :tags
|
19
18
|
alias_method_chain :read_multi, :tags
|
@@ -24,17 +23,13 @@ module Rails
|
|
24
23
|
# cache entry (for Dalli mainly)
|
25
24
|
Entry = Struct.new(:value, :tags)
|
26
25
|
|
27
|
-
|
28
|
-
|
29
|
-
def initialize_with_tags(*args)
|
30
|
-
initialize_without_tags(*args)
|
31
|
-
|
32
|
-
@tag_set = Set.new(self)
|
26
|
+
def tag_set
|
27
|
+
@tag_set ||= Set.new(self)
|
33
28
|
end
|
34
29
|
|
35
30
|
def read_with_tags(name, options = nil)
|
36
31
|
result = read_without_tags(name, options)
|
37
|
-
entry =
|
32
|
+
entry = tag_set.check(result)
|
38
33
|
|
39
34
|
if entry
|
40
35
|
entry
|
@@ -66,7 +61,7 @@ module Rails
|
|
66
61
|
result = read_multi_without_tags(*names)
|
67
62
|
|
68
63
|
names.each_with_object(Hash.new) do |name, hash|
|
69
|
-
hash[name.to_s] =
|
64
|
+
hash[name.to_s] = tag_set.check(result[name.to_s])
|
70
65
|
end
|
71
66
|
end
|
72
67
|
|
@@ -84,7 +79,7 @@ module Rails
|
|
84
79
|
result
|
85
80
|
else # only :read occured
|
86
81
|
# read occured, and result is fresh
|
87
|
-
if (entry =
|
82
|
+
if (entry = tag_set.check(result))
|
88
83
|
entry
|
89
84
|
else # result is stale
|
90
85
|
delete(name)
|
metadata
CHANGED
@@ -1,153 +1,153 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-cache-tags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexei Mikhailov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: i18n
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: appraisal
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: minitest
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '4.2'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '4.2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: memcache-client
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rack
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: mocha
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: simplecov
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: dalli
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '2.0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '2.0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rspec
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
description: Tagged caching support for Rails
|
@@ -174,17 +174,17 @@ require_paths:
|
|
174
174
|
- lib
|
175
175
|
required_ruby_version: !ruby/object:Gem::Requirement
|
176
176
|
requirements:
|
177
|
-
- -
|
177
|
+
- - ">="
|
178
178
|
- !ruby/object:Gem::Version
|
179
179
|
version: '0'
|
180
180
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
181
181
|
requirements:
|
182
|
-
- -
|
182
|
+
- - ">="
|
183
183
|
- !ruby/object:Gem::Version
|
184
184
|
version: '0'
|
185
185
|
requirements: []
|
186
186
|
rubyforge_project:
|
187
|
-
rubygems_version: 2.
|
187
|
+
rubygems_version: 2.2.2
|
188
188
|
signing_key:
|
189
189
|
specification_version: 4
|
190
190
|
summary: Tagged caching support for Rails
|