cachetastic 1.7.4 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +31 -44
- data/bin/cachetastic_drb_server +115 -0
- data/doc/classes/ActiveRecord/Base.html +16 -16
- data/doc/classes/CGI/Session/CachetasticStore.html +2 -2
- data/doc/classes/Cachetastic/Adapters/Base.html +74 -67
- data/doc/classes/Cachetastic/Adapters/Drb.html +11 -11
- data/doc/classes/Cachetastic/Adapters/File.html +5 -5
- data/doc/classes/Cachetastic/Adapters/FileBase.html +45 -45
- data/doc/classes/Cachetastic/Adapters/HtmlFile.html +23 -23
- data/doc/classes/Cachetastic/Adapters/LocalMemory.html +51 -51
- data/doc/classes/Cachetastic/Adapters/Memcache.html +89 -89
- data/doc/classes/Cachetastic/Cacheable.html +22 -22
- data/doc/classes/Cachetastic/Cacheable/ClassAndInstanceMethods.html +23 -23
- data/doc/classes/Cachetastic/Cacheable/ClassOnlyMethods.html +23 -23
- data/doc/classes/Cachetastic/Caches/Base.html +170 -199
- data/doc/classes/Cachetastic/Caches/Base/RegisteredCaches.html +9 -9
- data/doc/classes/Cachetastic/Caches/MackSessionCache.html +2 -2
- data/doc/classes/Cachetastic/Caches/PageCache.html +2 -2
- data/doc/classes/Cachetastic/Caches/RailsSessionCache.html +9 -9
- data/doc/classes/Cachetastic/Connection.html +5 -5
- data/doc/classes/Cachetastic/Errors/UnsupportedAdapter.html +9 -9
- data/doc/classes/Cachetastic/Logger.html +23 -24
- data/doc/classes/Object.html +41 -3
- data/doc/created.rid +1 -1
- data/doc/files/README.html +33 -52
- data/doc/files/lib/{adapters/cachetastic_adapters_base_rb.html → cachetastic/adapters/base_rb.html} +6 -6
- data/doc/files/lib/{adapters/cachetastic_adapters_drb_rb.html → cachetastic/adapters/drb_rb.html} +5 -5
- data/doc/files/lib/{adapters/cachetastic_adapters_file_base_rb.html → cachetastic/adapters/file_base_rb.html} +5 -5
- data/doc/files/lib/{adapters/cachetastic_adapters_file_rb.html → cachetastic/adapters/file_rb.html} +5 -5
- data/doc/files/lib/{adapters/cachetastic_adapters_html_file_rb.html → cachetastic/adapters/html_file_rb.html} +5 -5
- data/doc/files/lib/{adapters/cachetastic_adapters_local_memory_rb.html → cachetastic/adapters/local_memory_rb.html} +5 -5
- data/doc/files/lib/{adapters/cachetastic_adapters_memcache_rb.html → cachetastic/adapters/memcache_rb.html} +5 -5
- data/doc/files/lib/{cachetastic_cacheable_rb.html → cachetastic/adapters/store_object_rb.html} +5 -5
- data/doc/files/lib/{ruby_extensions/object_rb.html → cachetastic/cacheable_rb.html} +4 -4
- data/doc/files/lib/{caches/cachetastic_caches_base_rb.html → cachetastic/caches/base_rb.html} +5 -5
- data/doc/files/lib/{cachetastic_connection_rb.html → cachetastic/caches/mack_session_cache_rb.html} +6 -6
- data/doc/files/lib/{caches/cachetastic_caches_page_cache_rb.html → cachetastic/caches/page_cache_rb.html} +5 -5
- data/doc/files/lib/{caches/cachetastic_caches_rails_session_cache_rb.html → cachetastic/caches/rails_session_cache_rb.html} +5 -5
- data/doc/files/lib/{caches/cachetastic_caches_mack_session_cache_rb.html → cachetastic/connection_rb.html} +5 -5
- data/doc/files/lib/{adapters/cachetastic_adapters_store_object_rb.html → cachetastic/errors/unsupported_adapter_rb.html} +5 -5
- data/doc/files/lib/{cachetastic_logger_rb.html → cachetastic/logger_rb.html} +5 -5
- data/doc/files/lib/{rails_extensions/cachetastic_active_record_base_rb.html → cachetastic/rails_extensions/active_record_base_rb.html} +5 -5
- data/doc/files/lib/{rails_extensions/cgi_session_cachetastic_store_rb.html → cachetastic/rails_extensions/cgi_session_store_rb.html} +5 -5
- data/doc/files/lib/cachetastic/ruby_extensions/object_rb.html +101 -0
- data/doc/files/lib/cachetastic_rb.html +34 -53
- data/doc/fr_file_index.html +19 -19
- data/doc/fr_method_index.html +63 -62
- data/lib/cachetastic.rb +35 -22
- data/lib/{adapters/cachetastic_adapters_base.rb → cachetastic/adapters/base.rb} +23 -30
- data/lib/{adapters/cachetastic_adapters_drb.rb → cachetastic/adapters/drb.rb} +2 -2
- data/lib/{adapters/cachetastic_adapters_file.rb → cachetastic/adapters/file.rb} +0 -0
- data/lib/{adapters/cachetastic_adapters_file_base.rb → cachetastic/adapters/file_base.rb} +1 -1
- data/lib/{adapters/cachetastic_adapters_html_file.rb → cachetastic/adapters/html_file.rb} +0 -0
- data/lib/{adapters/cachetastic_adapters_local_memory.rb → cachetastic/adapters/local_memory.rb} +0 -0
- data/lib/{adapters/cachetastic_adapters_memcache.rb → cachetastic/adapters/memcache.rb} +3 -3
- data/lib/{adapters/cachetastic_adapters_store_object.rb → cachetastic/adapters/store_object.rb} +0 -0
- data/lib/{cachetastic_cacheable.rb → cachetastic/cacheable.rb} +0 -0
- data/lib/{caches/cachetastic_caches_base.rb → cachetastic/caches/base.rb} +11 -13
- data/lib/{caches/cachetastic_caches_mack_session_cache.rb → cachetastic/caches/mack_session_cache.rb} +0 -0
- data/lib/{caches/cachetastic_caches_page_cache.rb → cachetastic/caches/page_cache.rb} +0 -0
- data/lib/{caches/cachetastic_caches_rails_session_cache.rb → cachetastic/caches/rails_session_cache.rb} +0 -0
- data/lib/{cachetastic_connection.rb → cachetastic/connection.rb} +1 -1
- data/lib/{errors/cachetastic_errors_unsupported_adapter.rb → cachetastic/errors/unsupported_adapter.rb} +0 -0
- data/lib/cachetastic/logger.rb +49 -0
- data/lib/{rails_extensions/cachetastic_active_record_base.rb → cachetastic/rails_extensions/active_record_base.rb} +0 -0
- data/lib/{rails_extensions/cgi_session_cachetastic_store.rb → cachetastic/rails_extensions/cgi_session_store.rb} +0 -0
- data/lib/{ruby_extensions → cachetastic/ruby_extensions}/object.rb +0 -0
- data/test/config.rb +30 -0
- data/test/drb_adapter_test.rb +14 -0
- data/test/memcache_adapter_test.rb +14 -0
- data/test/test_helper.rb +8 -22
- metadata +58 -47
- data/doc/files/lib/errors/cachetastic_errors_unsupported_adapter_rb.html +0 -101
- data/lib/cachetastic_logger.rb +0 -44
- data/test/config.yml +0 -71
- data/test/data_mapper_test.rb +0 -9
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
<tr class="top-aligned-row">
|
|
56
56
|
<td><strong>In:</strong></td>
|
|
57
57
|
<td>
|
|
58
|
-
<a href="../../../files/lib/
|
|
59
|
-
lib/
|
|
58
|
+
<a href="../../../files/lib/cachetastic/cacheable_rb.html">
|
|
59
|
+
lib/cachetastic/cacheable.rb
|
|
60
60
|
</a>
|
|
61
61
|
<br />
|
|
62
62
|
</td>
|
|
@@ -80,9 +80,9 @@
|
|
|
80
80
|
<h3 class="section-bar">Methods</h3>
|
|
81
81
|
|
|
82
82
|
<div class="name-list">
|
|
83
|
-
<a href="#
|
|
84
|
-
<a href="#
|
|
85
|
-
<a href="#
|
|
83
|
+
<a href="#M000068">cache_class</a>
|
|
84
|
+
<a href="#M000069">cacher</a>
|
|
85
|
+
<a href="#M000070">expire_all</a>
|
|
86
86
|
</div>
|
|
87
87
|
</div>
|
|
88
88
|
|
|
@@ -104,11 +104,11 @@
|
|
|
104
104
|
<div id="methods">
|
|
105
105
|
<h3 class="section-bar">Public Instance methods</h3>
|
|
106
106
|
|
|
107
|
-
<div id="method-
|
|
108
|
-
<a name="
|
|
107
|
+
<div id="method-M000068" class="method-detail">
|
|
108
|
+
<a name="M000068"></a>
|
|
109
109
|
|
|
110
110
|
<div class="method-heading">
|
|
111
|
-
<a href="#
|
|
111
|
+
<a href="#M000068" class="method-signature">
|
|
112
112
|
<span class="method-name">cache_class</span><span class="method-args">()</span>
|
|
113
113
|
</a>
|
|
114
114
|
</div>
|
|
@@ -136,10 +136,10 @@ Example:
|
|
|
136
136
|
Person.cache_class # => Cachetastic::Cacheable::PersonCache
|
|
137
137
|
</pre>
|
|
138
138
|
<p><a class="source-toggle" href="#"
|
|
139
|
-
onclick="toggleCode('
|
|
140
|
-
<div class="method-source-code" id="
|
|
139
|
+
onclick="toggleCode('M000068-source');return false;">[Source]</a></p>
|
|
140
|
+
<div class="method-source-code" id="M000068-source">
|
|
141
141
|
<pre>
|
|
142
|
-
<span class="ruby-comment cmt"># File lib/
|
|
142
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/cacheable.rb, line 39</span>
|
|
143
143
|
39: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cache_class</span>
|
|
144
144
|
40: <span class="ruby-identifier">n</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>
|
|
145
145
|
41: <span class="ruby-identifier">n</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">name</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"Class"</span>
|
|
@@ -159,11 +159,11 @@ Example:
|
|
|
159
159
|
</div>
|
|
160
160
|
</div>
|
|
161
161
|
|
|
162
|
-
<div id="method-
|
|
163
|
-
<a name="
|
|
162
|
+
<div id="method-M000069" class="method-detail">
|
|
163
|
+
<a name="M000069"></a>
|
|
164
164
|
|
|
165
165
|
<div class="method-heading">
|
|
166
|
-
<a href="#
|
|
166
|
+
<a href="#M000069" class="method-signature">
|
|
167
167
|
<span class="method-name">cacher</span><span class="method-args">(key, expiry = 0) {|| ...}</span>
|
|
168
168
|
</a>
|
|
169
169
|
</div>
|
|
@@ -205,10 +205,10 @@ Example:
|
|
|
205
205
|
Cachetastic::Cacheable::PersonCache.get("say_hi") # => "Hi There"
|
|
206
206
|
</pre>
|
|
207
207
|
<p><a class="source-toggle" href="#"
|
|
208
|
-
onclick="toggleCode('
|
|
209
|
-
<div class="method-source-code" id="
|
|
208
|
+
onclick="toggleCode('M000069-source');return false;">[Source]</a></p>
|
|
209
|
+
<div class="method-source-code" id="M000069-source">
|
|
210
210
|
<pre>
|
|
211
|
-
<span class="ruby-comment cmt"># File lib/
|
|
211
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/cacheable.rb, line 84</span>
|
|
212
212
|
84: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cacher</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">expiry</span> = <span class="ruby-value">0</span>)
|
|
213
213
|
85: <span class="ruby-identifier">cache_class</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">key</span>) <span class="ruby-keyword kw">do</span>
|
|
214
214
|
86: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
|
@@ -222,11 +222,11 @@ Example:
|
|
|
222
222
|
</div>
|
|
223
223
|
</div>
|
|
224
224
|
|
|
225
|
-
<div id="method-
|
|
226
|
-
<a name="
|
|
225
|
+
<div id="method-M000070" class="method-detail">
|
|
226
|
+
<a name="M000070"></a>
|
|
227
227
|
|
|
228
228
|
<div class="method-heading">
|
|
229
|
-
<a href="#
|
|
229
|
+
<a href="#M000070" class="method-signature">
|
|
230
230
|
<span class="method-name">expire_all</span><span class="method-args">()</span>
|
|
231
231
|
</a>
|
|
232
232
|
</div>
|
|
@@ -257,10 +257,10 @@ Example:
|
|
|
257
257
|
Person.get_from_cache(1) # => nil
|
|
258
258
|
</pre>
|
|
259
259
|
<p><a class="source-toggle" href="#"
|
|
260
|
-
onclick="toggleCode('
|
|
261
|
-
<div class="method-source-code" id="
|
|
260
|
+
onclick="toggleCode('M000070-source');return false;">[Source]</a></p>
|
|
261
|
+
<div class="method-source-code" id="M000070-source">
|
|
262
262
|
<pre>
|
|
263
|
-
<span class="ruby-comment cmt"># File lib/
|
|
263
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/cacheable.rb, line 112</span>
|
|
264
264
|
112: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">expire_all</span>
|
|
265
265
|
113: <span class="ruby-identifier">cache_class</span>.<span class="ruby-identifier">expire_all</span>
|
|
266
266
|
114: <span class="ruby-keyword kw">end</span>
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
<tr class="top-aligned-row">
|
|
56
56
|
<td><strong>In:</strong></td>
|
|
57
57
|
<td>
|
|
58
|
-
<a href="../../../files/lib/
|
|
59
|
-
lib/
|
|
58
|
+
<a href="../../../files/lib/cachetastic/cacheable_rb.html">
|
|
59
|
+
lib/cachetastic/cacheable.rb
|
|
60
60
|
</a>
|
|
61
61
|
<br />
|
|
62
62
|
</td>
|
|
@@ -80,9 +80,9 @@
|
|
|
80
80
|
<h3 class="section-bar">Methods</h3>
|
|
81
81
|
|
|
82
82
|
<div class="name-list">
|
|
83
|
-
<a href="#
|
|
84
|
-
<a href="#
|
|
85
|
-
<a href="#
|
|
83
|
+
<a href="#M000066">delete_from_cache</a>
|
|
84
|
+
<a href="#M000065">get_from_cache</a>
|
|
85
|
+
<a href="#M000067">set_into_cache</a>
|
|
86
86
|
</div>
|
|
87
87
|
</div>
|
|
88
88
|
|
|
@@ -104,11 +104,11 @@
|
|
|
104
104
|
<div id="methods">
|
|
105
105
|
<h3 class="section-bar">Public Instance methods</h3>
|
|
106
106
|
|
|
107
|
-
<div id="method-
|
|
108
|
-
<a name="
|
|
107
|
+
<div id="method-M000066" class="method-detail">
|
|
108
|
+
<a name="M000066"></a>
|
|
109
109
|
|
|
110
110
|
<div class="method-heading">
|
|
111
|
-
<a href="#
|
|
111
|
+
<a href="#M000066" class="method-signature">
|
|
112
112
|
<span class="method-name">delete_from_cache</span><span class="method-args">(key)</span>
|
|
113
113
|
</a>
|
|
114
114
|
</div>
|
|
@@ -118,10 +118,10 @@
|
|
|
118
118
|
Deletes an object from the cache for a given key.
|
|
119
119
|
</p>
|
|
120
120
|
<p><a class="source-toggle" href="#"
|
|
121
|
-
onclick="toggleCode('
|
|
122
|
-
<div class="method-source-code" id="
|
|
121
|
+
onclick="toggleCode('M000066-source');return false;">[Source]</a></p>
|
|
122
|
+
<div class="method-source-code" id="M000066-source">
|
|
123
123
|
<pre>
|
|
124
|
-
<span class="ruby-comment cmt"># File lib/
|
|
124
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/cacheable.rb, line 185</span>
|
|
125
125
|
185: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete_from_cache</span>(<span class="ruby-identifier">key</span>)
|
|
126
126
|
186: <span class="ruby-identifier">cache_class</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>)
|
|
127
127
|
187: <span class="ruby-keyword kw">end</span>
|
|
@@ -130,11 +130,11 @@ Deletes an object from the cache for a given key.
|
|
|
130
130
|
</div>
|
|
131
131
|
</div>
|
|
132
132
|
|
|
133
|
-
<div id="method-
|
|
134
|
-
<a name="
|
|
133
|
+
<div id="method-M000065" class="method-detail">
|
|
134
|
+
<a name="M000065"></a>
|
|
135
135
|
|
|
136
136
|
<div class="method-heading">
|
|
137
|
-
<a href="#
|
|
137
|
+
<a href="#M000065" class="method-signature">
|
|
138
138
|
<span class="method-name">get_from_cache</span><span class="method-args">(key, &block)</span>
|
|
139
139
|
</a>
|
|
140
140
|
</div>
|
|
@@ -144,10 +144,10 @@ Deletes an object from the cache for a given key.
|
|
|
144
144
|
Returns an object from the cache for a given key.
|
|
145
145
|
</p>
|
|
146
146
|
<p><a class="source-toggle" href="#"
|
|
147
|
-
onclick="toggleCode('
|
|
148
|
-
<div class="method-source-code" id="
|
|
147
|
+
onclick="toggleCode('M000065-source');return false;">[Source]</a></p>
|
|
148
|
+
<div class="method-source-code" id="M000065-source">
|
|
149
149
|
<pre>
|
|
150
|
-
<span class="ruby-comment cmt"># File lib/
|
|
150
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/cacheable.rb, line 180</span>
|
|
151
151
|
180: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_from_cache</span>(<span class="ruby-identifier">key</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
|
152
152
|
181: <span class="ruby-identifier">cache_class</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">key</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
|
153
153
|
182: <span class="ruby-keyword kw">end</span>
|
|
@@ -156,11 +156,11 @@ Returns an object from the cache for a given key.
|
|
|
156
156
|
</div>
|
|
157
157
|
</div>
|
|
158
158
|
|
|
159
|
-
<div id="method-
|
|
160
|
-
<a name="
|
|
159
|
+
<div id="method-M000067" class="method-detail">
|
|
160
|
+
<a name="M000067"></a>
|
|
161
161
|
|
|
162
162
|
<div class="method-heading">
|
|
163
|
-
<a href="#
|
|
163
|
+
<a href="#M000067" class="method-signature">
|
|
164
164
|
<span class="method-name">set_into_cache</span><span class="method-args">(key, value, expiry = 0)</span>
|
|
165
165
|
</a>
|
|
166
166
|
</div>
|
|
@@ -170,10 +170,10 @@ Returns an object from the cache for a given key.
|
|
|
170
170
|
Sets an object into the cache for a given key.
|
|
171
171
|
</p>
|
|
172
172
|
<p><a class="source-toggle" href="#"
|
|
173
|
-
onclick="toggleCode('
|
|
174
|
-
<div class="method-source-code" id="
|
|
173
|
+
onclick="toggleCode('M000067-source');return false;">[Source]</a></p>
|
|
174
|
+
<div class="method-source-code" id="M000067-source">
|
|
175
175
|
<pre>
|
|
176
|
-
<span class="ruby-comment cmt"># File lib/
|
|
176
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/cacheable.rb, line 190</span>
|
|
177
177
|
190: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_into_cache</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>, <span class="ruby-identifier">expiry</span> = <span class="ruby-value">0</span>)
|
|
178
178
|
191: <span class="ruby-identifier">cache_class</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>, <span class="ruby-identifier">expiry</span>)
|
|
179
179
|
192: <span class="ruby-keyword kw">end</span>
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
<tr class="top-aligned-row">
|
|
56
56
|
<td><strong>In:</strong></td>
|
|
57
57
|
<td>
|
|
58
|
-
<a href="../../../files/lib/caches/
|
|
59
|
-
lib/caches/
|
|
58
|
+
<a href="../../../files/lib/cachetastic/caches/base_rb.html">
|
|
59
|
+
lib/cachetastic/caches/base.rb
|
|
60
60
|
</a>
|
|
61
61
|
<br />
|
|
62
62
|
</td>
|
|
@@ -120,21 +120,20 @@ different for your cache.
|
|
|
120
120
|
<h3 class="section-bar">Methods</h3>
|
|
121
121
|
|
|
122
122
|
<div class="name-list">
|
|
123
|
-
<a href="#
|
|
124
|
-
<a href="#
|
|
125
|
-
<a href="#
|
|
126
|
-
<a href="#
|
|
127
|
-
<a href="#
|
|
128
|
-
<a href="#
|
|
129
|
-
<a href="#
|
|
130
|
-
<a href="#
|
|
131
|
-
<a href="#
|
|
132
|
-
<a href="#
|
|
133
|
-
<a href="#
|
|
134
|
-
<a href="#
|
|
135
|
-
<a href="#
|
|
136
|
-
<a href="#
|
|
137
|
-
<a href="#M000066">unsupported_adapters</a>
|
|
123
|
+
<a href="#M000055">adapter</a>
|
|
124
|
+
<a href="#M000058">adapter_supported?</a>
|
|
125
|
+
<a href="#M000048">all_registered_caches</a>
|
|
126
|
+
<a href="#M000054">cache_name</a>
|
|
127
|
+
<a href="#M000061">calculate_expiry_time</a>
|
|
128
|
+
<a href="#M000051">delete</a>
|
|
129
|
+
<a href="#M000052">expire_all</a>
|
|
130
|
+
<a href="#M000049">get</a>
|
|
131
|
+
<a href="#M000056">logger</a>
|
|
132
|
+
<a href="#M000059">marshall</a>
|
|
133
|
+
<a href="#M000050">set</a>
|
|
134
|
+
<a href="#M000053">stats</a>
|
|
135
|
+
<a href="#M000060">unmarshall</a>
|
|
136
|
+
<a href="#M000057">unsupported_adapters</a>
|
|
138
137
|
</div>
|
|
139
138
|
</div>
|
|
140
139
|
|
|
@@ -175,11 +174,11 @@ different for your cache.
|
|
|
175
174
|
<div id="methods">
|
|
176
175
|
<h3 class="section-bar">Public Class methods</h3>
|
|
177
176
|
|
|
178
|
-
<div id="method-
|
|
179
|
-
<a name="
|
|
177
|
+
<div id="method-M000055" class="method-detail">
|
|
178
|
+
<a name="M000055"></a>
|
|
180
179
|
|
|
181
180
|
<div class="method-heading">
|
|
182
|
-
<a href="#
|
|
181
|
+
<a href="#M000055" class="method-signature">
|
|
183
182
|
<span class="method-name">adapter</span><span class="method-args">()</span>
|
|
184
183
|
</a>
|
|
185
184
|
</div>
|
|
@@ -191,55 +190,55 @@ href="../Adapters/Base.html">Cachetastic::Adapters::Base</a> for this
|
|
|
191
190
|
cache.
|
|
192
191
|
</p>
|
|
193
192
|
<p><a class="source-toggle" href="#"
|
|
194
|
-
onclick="toggleCode('
|
|
195
|
-
<div class="method-source-code" id="
|
|
193
|
+
onclick="toggleCode('M000055-source');return false;">[Source]</a></p>
|
|
194
|
+
<div class="method-source-code" id="M000055-source">
|
|
196
195
|
<pre>
|
|
197
|
-
<span class="ruby-comment cmt"># File lib/caches/
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
196
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 139</span>
|
|
197
|
+
139: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">adapter</span>
|
|
198
|
+
140: <span class="ruby-identifier">a</span> = <span class="ruby-identifier">cache_conn_instance</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">cache_name</span>)
|
|
199
|
+
141: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">adapter_supported?</span>(<span class="ruby-identifier">a</span>.<span class="ruby-identifier">class</span>)
|
|
200
|
+
142: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">a</span>
|
|
201
|
+
143: <span class="ruby-keyword kw">else</span>
|
|
202
|
+
144: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Cachetastic</span><span class="ruby-operator">::</span><span class="ruby-constant">Errors</span><span class="ruby-operator">::</span><span class="ruby-constant">UnsupportedAdapter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">cache_name</span>, <span class="ruby-identifier">a</span>.<span class="ruby-identifier">class</span>)
|
|
203
|
+
145: <span class="ruby-keyword kw">end</span>
|
|
204
|
+
146: <span class="ruby-keyword kw">end</span>
|
|
206
205
|
</pre>
|
|
207
206
|
</div>
|
|
208
207
|
</div>
|
|
209
208
|
</div>
|
|
210
209
|
|
|
211
|
-
<div id="method-
|
|
212
|
-
<a name="
|
|
210
|
+
<div id="method-M000058" class="method-detail">
|
|
211
|
+
<a name="M000058"></a>
|
|
213
212
|
|
|
214
213
|
<div class="method-heading">
|
|
215
|
-
<a href="#
|
|
214
|
+
<a href="#M000058" class="method-signature">
|
|
216
215
|
<span class="method-name">adapter_supported?</span><span class="method-args">(a = cache_conn_instance.get(cache_name).class)</span>
|
|
217
216
|
</a>
|
|
218
217
|
</div>
|
|
219
218
|
|
|
220
219
|
<div class="method-description">
|
|
221
220
|
<p>
|
|
222
|
-
Returns true/false on whether the <a href="Base.html#
|
|
221
|
+
Returns true/false on whether the <a href="Base.html#M000055">adapter</a>
|
|
223
222
|
you want to use is supported for the cache.
|
|
224
223
|
</p>
|
|
225
224
|
<p><a class="source-toggle" href="#"
|
|
226
|
-
onclick="toggleCode('
|
|
227
|
-
<div class="method-source-code" id="
|
|
225
|
+
onclick="toggleCode('M000058-source');return false;">[Source]</a></p>
|
|
226
|
+
<div class="method-source-code" id="M000058-source">
|
|
228
227
|
<pre>
|
|
229
|
-
<span class="ruby-comment cmt"># File lib/caches/
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
228
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 161</span>
|
|
229
|
+
161: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">adapter_supported?</span>(<span class="ruby-identifier">a</span> = <span class="ruby-identifier">cache_conn_instance</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">cache_name</span>).<span class="ruby-identifier">class</span>)
|
|
230
|
+
162: <span class="ruby-keyword kw">return</span> <span class="ruby-operator">!</span><span class="ruby-identifier">unsupported_adapters</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">a</span>)
|
|
231
|
+
163: <span class="ruby-keyword kw">end</span>
|
|
233
232
|
</pre>
|
|
234
233
|
</div>
|
|
235
234
|
</div>
|
|
236
235
|
</div>
|
|
237
236
|
|
|
238
|
-
<div id="method-
|
|
239
|
-
<a name="
|
|
237
|
+
<div id="method-M000048" class="method-detail">
|
|
238
|
+
<a name="M000048"></a>
|
|
240
239
|
|
|
241
240
|
<div class="method-heading">
|
|
242
|
-
<a href="#
|
|
241
|
+
<a href="#M000048" class="method-signature">
|
|
243
242
|
<span class="method-name">all_registered_caches</span><span class="method-args">()</span>
|
|
244
243
|
</a>
|
|
245
244
|
</div>
|
|
@@ -249,10 +248,10 @@ you want to use is supported for the cache.
|
|
|
249
248
|
Returns a list of all registered caches in the system.
|
|
250
249
|
</p>
|
|
251
250
|
<p><a class="source-toggle" href="#"
|
|
252
|
-
onclick="toggleCode('
|
|
253
|
-
<div class="method-source-code" id="
|
|
251
|
+
onclick="toggleCode('M000048-source');return false;">[Source]</a></p>
|
|
252
|
+
<div class="method-source-code" id="M000048-source">
|
|
254
253
|
<pre>
|
|
255
|
-
<span class="ruby-comment cmt"># File lib/caches/
|
|
254
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 48</span>
|
|
256
255
|
48: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">all_registered_caches</span>
|
|
257
256
|
49: <span class="ruby-constant">RegisteredCaches</span>.<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">list</span>
|
|
258
257
|
50: <span class="ruby-keyword kw">end</span>
|
|
@@ -261,11 +260,11 @@ Returns a list of all registered caches in the system.
|
|
|
261
260
|
</div>
|
|
262
261
|
</div>
|
|
263
262
|
|
|
264
|
-
<div id="method-
|
|
265
|
-
<a name="
|
|
263
|
+
<div id="method-M000054" class="method-detail">
|
|
264
|
+
<a name="M000054"></a>
|
|
266
265
|
|
|
267
266
|
<div class="method-heading">
|
|
268
|
-
<a href="#
|
|
267
|
+
<a href="#M000054" class="method-signature">
|
|
269
268
|
<span class="method-name">cache_name</span><span class="method-args">()</span>
|
|
270
269
|
</a>
|
|
271
270
|
</div>
|
|
@@ -281,23 +280,23 @@ href="../Connection.html">Cachetastic::Connection</a> class.
|
|
|
281
280
|
Cachetastic::Caches::Base # => "cachetastic_caches_base"
|
|
282
281
|
</pre>
|
|
283
282
|
<p><a class="source-toggle" href="#"
|
|
284
|
-
onclick="toggleCode('
|
|
285
|
-
<div class="method-source-code" id="
|
|
283
|
+
onclick="toggleCode('M000054-source');return false;">[Source]</a></p>
|
|
284
|
+
<div class="method-source-code" id="M000054-source">
|
|
286
285
|
<pre>
|
|
287
|
-
<span class="ruby-comment cmt"># File lib/caches/
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
286
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 134</span>
|
|
287
|
+
134: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cache_name</span>
|
|
288
|
+
135: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">methodize</span>
|
|
289
|
+
136: <span class="ruby-keyword kw">end</span>
|
|
291
290
|
</pre>
|
|
292
291
|
</div>
|
|
293
292
|
</div>
|
|
294
293
|
</div>
|
|
295
294
|
|
|
296
|
-
<div id="method-
|
|
297
|
-
<a name="
|
|
295
|
+
<div id="method-M000051" class="method-detail">
|
|
296
|
+
<a name="M000051"></a>
|
|
298
297
|
|
|
299
298
|
<div class="method-heading">
|
|
300
|
-
<a href="#
|
|
299
|
+
<a href="#M000051" class="method-signature">
|
|
301
300
|
<span class="method-name">delete</span><span class="method-args">(key, delay = 0)</span>
|
|
302
301
|
</a>
|
|
303
302
|
</div>
|
|
@@ -306,14 +305,14 @@ href="../Connection.html">Cachetastic::Connection</a> class.
|
|
|
306
305
|
<p>
|
|
307
306
|
Deletes an object from the cache. The optional delay parameter sets an
|
|
308
307
|
offset, in seconds, for when the object should <a
|
|
309
|
-
href="Base.html#
|
|
308
|
+
href="Base.html#M000049">get</a> deleted. The default of 0 means the object
|
|
310
309
|
gets deleted right away.
|
|
311
310
|
</p>
|
|
312
311
|
<p><a class="source-toggle" href="#"
|
|
313
|
-
onclick="toggleCode('
|
|
314
|
-
<div class="method-source-code" id="
|
|
312
|
+
onclick="toggleCode('M000051-source');return false;">[Source]</a></p>
|
|
313
|
+
<div class="method-source-code" id="M000051-source">
|
|
315
314
|
<pre>
|
|
316
|
-
<span class="ruby-comment cmt"># File lib/caches/
|
|
315
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 108</span>
|
|
317
316
|
108: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">delay</span> = <span class="ruby-value">0</span>)
|
|
318
317
|
109: <span class="ruby-identifier">do_with_logging</span>(<span class="ruby-identifier">:delete</span>, <span class="ruby-identifier">key</span>) <span class="ruby-keyword kw">do</span>
|
|
319
318
|
110: <span class="ruby-identifier">adapter</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">delay</span>)
|
|
@@ -324,11 +323,11 @@ gets deleted right away.
|
|
|
324
323
|
</div>
|
|
325
324
|
</div>
|
|
326
325
|
|
|
327
|
-
<div id="method-
|
|
328
|
-
<a name="
|
|
326
|
+
<div id="method-M000052" class="method-detail">
|
|
327
|
+
<a name="M000052"></a>
|
|
329
328
|
|
|
330
329
|
<div class="method-heading">
|
|
331
|
-
<a href="#
|
|
330
|
+
<a href="#M000052" class="method-signature">
|
|
332
331
|
<span class="method-name">expire_all</span><span class="method-args">()</span>
|
|
333
332
|
</a>
|
|
334
333
|
</div>
|
|
@@ -338,10 +337,10 @@ gets deleted right away.
|
|
|
338
337
|
Expires all objects for this cache.
|
|
339
338
|
</p>
|
|
340
339
|
<p><a class="source-toggle" href="#"
|
|
341
|
-
onclick="toggleCode('
|
|
342
|
-
<div class="method-source-code" id="
|
|
340
|
+
onclick="toggleCode('M000052-source');return false;">[Source]</a></p>
|
|
341
|
+
<div class="method-source-code" id="M000052-source">
|
|
343
342
|
<pre>
|
|
344
|
-
<span class="ruby-comment cmt"># File lib/caches/
|
|
343
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 115</span>
|
|
345
344
|
115: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">expire_all</span>
|
|
346
345
|
116: <span class="ruby-identifier">adapter</span>.<span class="ruby-identifier">expire_all</span>
|
|
347
346
|
117: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-value str">''</span>, <span class="ruby-value str">''</span>, <span class="ruby-identifier">:expired</span>, <span class="ruby-identifier">cache_name</span>)
|
|
@@ -351,11 +350,11 @@ Expires all objects for this cache.
|
|
|
351
350
|
</div>
|
|
352
351
|
</div>
|
|
353
352
|
|
|
354
|
-
<div id="method-
|
|
355
|
-
<a name="
|
|
353
|
+
<div id="method-M000049" class="method-detail">
|
|
354
|
+
<a name="M000049"></a>
|
|
356
355
|
|
|
357
356
|
<div class="method-heading">
|
|
358
|
-
<a href="#
|
|
357
|
+
<a href="#M000049" class="method-signature">
|
|
359
358
|
<span class="method-name">get</span><span class="method-args">(key) {|key if block_given?| ...}</span>
|
|
360
359
|
</a>
|
|
361
360
|
</div>
|
|
@@ -365,14 +364,14 @@ Expires all objects for this cache.
|
|
|
365
364
|
Returns an object from the cache for a given key. If the object comes back
|
|
366
365
|
as nil and a block is given that block will be run and the results of the
|
|
367
366
|
block will be run. This can be used to JIT caches, just make sure in the
|
|
368
|
-
block to call the <a href="Base.html#
|
|
367
|
+
block to call the <a href="Base.html#M000050">set</a> method because the
|
|
369
368
|
results of the block are not automatically cached.
|
|
370
369
|
</p>
|
|
371
370
|
<p><a class="source-toggle" href="#"
|
|
372
|
-
onclick="toggleCode('
|
|
373
|
-
<div class="method-source-code" id="
|
|
371
|
+
onclick="toggleCode('M000049-source');return false;">[Source]</a></p>
|
|
372
|
+
<div class="method-source-code" id="M000049-source">
|
|
374
373
|
<pre>
|
|
375
|
-
<span class="ruby-comment cmt"># File lib/caches/
|
|
374
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 58</span>
|
|
376
375
|
58: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get</span>(<span class="ruby-identifier">key</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
|
377
376
|
59: <span class="ruby-identifier">res</span> = <span class="ruby-keyword kw">nil</span>
|
|
378
377
|
60: <span class="ruby-identifier">do_with_logging</span>(<span class="ruby-identifier">:get</span>, <span class="ruby-identifier">key</span>) <span class="ruby-keyword kw">do</span>
|
|
@@ -406,11 +405,11 @@ results of the block are not automatically cached.
|
|
|
406
405
|
</div>
|
|
407
406
|
</div>
|
|
408
407
|
|
|
409
|
-
<div id="method-
|
|
410
|
-
<a name="
|
|
408
|
+
<div id="method-M000056" class="method-detail">
|
|
409
|
+
<a name="M000056"></a>
|
|
411
410
|
|
|
412
411
|
<div class="method-heading">
|
|
413
|
-
<a href="#
|
|
412
|
+
<a href="#M000056" class="method-signature">
|
|
414
413
|
<span class="method-name">logger</span><span class="method-args">()</span>
|
|
415
414
|
</a>
|
|
416
415
|
</div>
|
|
@@ -421,83 +420,55 @@ Returns the <a href="../Logger.html">Cachetastic::Logger</a> for the
|
|
|
421
420
|
underlying <a href="../Adapters/Base.html">Cachetastic::Adapters::Base</a>.
|
|
422
421
|
</p>
|
|
423
422
|
<p><a class="source-toggle" href="#"
|
|
424
|
-
onclick="toggleCode('
|
|
425
|
-
<div class="method-source-code" id="
|
|
423
|
+
onclick="toggleCode('M000056-source');return false;">[Source]</a></p>
|
|
424
|
+
<div class="method-source-code" id="M000056-source">
|
|
426
425
|
<pre>
|
|
427
|
-
<span class="ruby-comment cmt"># File lib/caches/
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
426
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 149</span>
|
|
427
|
+
149: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">logger</span>
|
|
428
|
+
150: <span class="ruby-identifier">adapter</span>.<span class="ruby-identifier">logger</span>
|
|
429
|
+
151: <span class="ruby-keyword kw">end</span>
|
|
431
430
|
</pre>
|
|
432
431
|
</div>
|
|
433
432
|
</div>
|
|
434
433
|
</div>
|
|
435
434
|
|
|
436
|
-
<div id="method-
|
|
437
|
-
<a name="
|
|
435
|
+
<div id="method-M000059" class="method-detail">
|
|
436
|
+
<a name="M000059"></a>
|
|
438
437
|
|
|
439
438
|
<div class="method-heading">
|
|
440
|
-
<a href="#
|
|
439
|
+
<a href="#M000059" class="method-signature">
|
|
441
440
|
<span class="method-name">marshall</span><span class="method-args">(value)</span>
|
|
442
441
|
</a>
|
|
443
442
|
</div>
|
|
444
443
|
|
|
445
444
|
<div class="method-description">
|
|
446
445
|
<p><a class="source-toggle" href="#"
|
|
447
|
-
onclick="toggleCode('
|
|
448
|
-
<div class="method-source-code" id="
|
|
449
|
-
<pre>
|
|
450
|
-
<span class="ruby-comment cmt"># File lib/caches/cachetastic_caches_base.rb, line 167</span>
|
|
451
|
-
167: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">marshall</span>(<span class="ruby-identifier">value</span>)
|
|
452
|
-
168: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">value</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span>
|
|
453
|
-
169: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">adapter</span>.<span class="ruby-identifier">all_options</span>[<span class="ruby-value str">"marshall_method"</span>]
|
|
454
|
-
170: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"yaml"</span>
|
|
455
|
-
171: <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">value</span>)
|
|
456
|
-
172: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"ruby"</span>
|
|
457
|
-
173: <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">value</span>)
|
|
458
|
-
174: <span class="ruby-keyword kw">else</span>
|
|
459
|
-
175: <span class="ruby-identifier">value</span>
|
|
460
|
-
176: <span class="ruby-keyword kw">end</span>
|
|
461
|
-
177: <span class="ruby-keyword kw">end</span>
|
|
462
|
-
</pre>
|
|
463
|
-
</div>
|
|
464
|
-
</div>
|
|
465
|
-
</div>
|
|
466
|
-
|
|
467
|
-
<div id="method-M000061" class="method-detail">
|
|
468
|
-
<a name="M000061"></a>
|
|
469
|
-
|
|
470
|
-
<div class="method-heading">
|
|
471
|
-
<a href="#M000061" class="method-signature">
|
|
472
|
-
<span class="method-name">populate_all</span><span class="method-args">()</span>
|
|
473
|
-
</a>
|
|
474
|
-
</div>
|
|
475
|
-
|
|
476
|
-
<div class="method-description">
|
|
477
|
-
<p>
|
|
478
|
-
Raises a MethodNotImplemented exception. This method should be overridden
|
|
479
|
-
in the child class to enable a populating the cache with all things that
|
|
480
|
-
should be in there.
|
|
481
|
-
</p>
|
|
482
|
-
<p><a class="source-toggle" href="#"
|
|
483
|
-
onclick="toggleCode('M000061-source');return false;">[Source]</a></p>
|
|
484
|
-
<div class="method-source-code" id="M000061-source">
|
|
446
|
+
onclick="toggleCode('M000059-source');return false;">[Source]</a></p>
|
|
447
|
+
<div class="method-source-code" id="M000059-source">
|
|
485
448
|
<pre>
|
|
486
|
-
<span class="ruby-comment cmt"># File lib/caches/
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
449
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 165</span>
|
|
450
|
+
165: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">marshall</span>(<span class="ruby-identifier">value</span>)
|
|
451
|
+
166: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">value</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span>
|
|
452
|
+
167: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">adapter</span>.<span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">retrieve</span>(<span class="ruby-identifier">:marshall_method</span>, <span class="ruby-identifier">:none</span>).<span class="ruby-identifier">to_sym</span>
|
|
453
|
+
168: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:yaml</span>
|
|
454
|
+
169: <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">value</span>)
|
|
455
|
+
170: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:ruby</span>
|
|
456
|
+
171: <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">value</span>)
|
|
457
|
+
172: <span class="ruby-keyword kw">else</span>
|
|
458
|
+
173: <span class="ruby-identifier">value</span>
|
|
459
|
+
174: <span class="ruby-keyword kw">end</span>
|
|
460
|
+
175: <span class="ruby-keyword kw">end</span>
|
|
490
461
|
</pre>
|
|
491
462
|
</div>
|
|
492
463
|
</div>
|
|
493
464
|
</div>
|
|
494
465
|
|
|
495
|
-
<div id="method-
|
|
496
|
-
<a name="
|
|
466
|
+
<div id="method-M000050" class="method-detail">
|
|
467
|
+
<a name="M000050"></a>
|
|
497
468
|
|
|
498
469
|
<div class="method-heading">
|
|
499
|
-
<a href="#
|
|
500
|
-
<span class="method-name">set</span><span class="method-args">(key, value, expiry =
|
|
470
|
+
<a href="#M000050" class="method-signature">
|
|
471
|
+
<span class="method-name">set</span><span class="method-args">(key, value, expiry = adapter.configuration.retrieve(:default_expiry, 0))</span>
|
|
501
472
|
</a>
|
|
502
473
|
</div>
|
|
503
474
|
|
|
@@ -505,19 +476,19 @@ should be in there.
|
|
|
505
476
|
<p>
|
|
506
477
|
Set a particular object info the cache for the given key. An optional third
|
|
507
478
|
parameter sets the expiry time for the object in the cache. The default for
|
|
508
|
-
this expiry is <a href="Base.html#
|
|
479
|
+
this expiry is <a href="Base.html#M000050">set</a> as either 0, meaning it
|
|
509
480
|
never expires, or if there‘s a default_expiry time <a
|
|
510
|
-
href="Base.html#
|
|
511
|
-
used. If there is an expiry_swing <a href="Base.html#
|
|
481
|
+
href="Base.html#M000050">set</a> in the config file, that file will be
|
|
482
|
+
used. If there is an expiry_swing <a href="Base.html#M000050">set</a> in
|
|
512
483
|
the config file it will be +/- to the expiry time. See also: <a
|
|
513
|
-
href="Base.html#
|
|
484
|
+
href="Base.html#M000061">calculate_expiry_time</a>
|
|
514
485
|
</p>
|
|
515
486
|
<p><a class="source-toggle" href="#"
|
|
516
|
-
onclick="toggleCode('
|
|
517
|
-
<div class="method-source-code" id="
|
|
487
|
+
onclick="toggleCode('M000050-source');return false;">[Source]</a></p>
|
|
488
|
+
<div class="method-source-code" id="M000050-source">
|
|
518
489
|
<pre>
|
|
519
|
-
<span class="ruby-comment cmt"># File lib/caches/
|
|
520
|
-
94: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>, <span class="ruby-identifier">expiry</span> =
|
|
490
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 94</span>
|
|
491
|
+
94: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>, <span class="ruby-identifier">expiry</span> = <span class="ruby-identifier">adapter</span>.<span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">retrieve</span>(<span class="ruby-identifier">:default_expiry</span>, <span class="ruby-value">0</span>))
|
|
521
492
|
95: <span class="ruby-identifier">do_with_logging</span>(<span class="ruby-identifier">:set</span>, <span class="ruby-identifier">key</span>) <span class="ruby-keyword kw">do</span>
|
|
522
493
|
96: <span class="ruby-identifier">expiry</span> = <span class="ruby-identifier">calculate_expiry_time</span>(<span class="ruby-identifier">expiry</span>)
|
|
523
494
|
97: <span class="ruby-identifier">adapter</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">marshall</span>(<span class="ruby-identifier">value</span>), <span class="ruby-identifier">expiry</span>.<span class="ruby-identifier">to_i</span>)
|
|
@@ -530,11 +501,11 @@ href="Base.html#M000070">calculate_expiry_time</a>
|
|
|
530
501
|
</div>
|
|
531
502
|
</div>
|
|
532
503
|
|
|
533
|
-
<div id="method-
|
|
534
|
-
<a name="
|
|
504
|
+
<div id="method-M000053" class="method-detail">
|
|
505
|
+
<a name="M000053"></a>
|
|
535
506
|
|
|
536
507
|
<div class="method-heading">
|
|
537
|
-
<a href="#
|
|
508
|
+
<a href="#M000053" class="method-signature">
|
|
538
509
|
<span class="method-name">stats</span><span class="method-args">()</span>
|
|
539
510
|
</a>
|
|
540
511
|
</div>
|
|
@@ -545,54 +516,54 @@ A convenience method that returns statistics for the underlying <a
|
|
|
545
516
|
href="../Adapters/Base.html">Cachetastic::Adapters::Base</a> for the cache.
|
|
546
517
|
</p>
|
|
547
518
|
<p><a class="source-toggle" href="#"
|
|
548
|
-
onclick="toggleCode('
|
|
549
|
-
<div class="method-source-code" id="
|
|
519
|
+
onclick="toggleCode('M000053-source');return false;">[Source]</a></p>
|
|
520
|
+
<div class="method-source-code" id="M000053-source">
|
|
550
521
|
<pre>
|
|
551
|
-
<span class="ruby-comment cmt"># File lib/caches/
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
522
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 126</span>
|
|
523
|
+
126: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stats</span>
|
|
524
|
+
127: <span class="ruby-identifier">adapter</span>.<span class="ruby-identifier">stats</span>
|
|
525
|
+
128: <span class="ruby-keyword kw">end</span>
|
|
555
526
|
</pre>
|
|
556
527
|
</div>
|
|
557
528
|
</div>
|
|
558
529
|
</div>
|
|
559
530
|
|
|
560
|
-
<div id="method-
|
|
561
|
-
<a name="
|
|
531
|
+
<div id="method-M000060" class="method-detail">
|
|
532
|
+
<a name="M000060"></a>
|
|
562
533
|
|
|
563
534
|
<div class="method-heading">
|
|
564
|
-
<a href="#
|
|
535
|
+
<a href="#M000060" class="method-signature">
|
|
565
536
|
<span class="method-name">unmarshall</span><span class="method-args">(value)</span>
|
|
566
537
|
</a>
|
|
567
538
|
</div>
|
|
568
539
|
|
|
569
540
|
<div class="method-description">
|
|
570
541
|
<p><a class="source-toggle" href="#"
|
|
571
|
-
onclick="toggleCode('
|
|
572
|
-
<div class="method-source-code" id="
|
|
542
|
+
onclick="toggleCode('M000060-source');return false;">[Source]</a></p>
|
|
543
|
+
<div class="method-source-code" id="M000060-source">
|
|
573
544
|
<pre>
|
|
574
|
-
<span class="ruby-comment cmt"># File lib/caches/
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
545
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 177</span>
|
|
546
|
+
177: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unmarshall</span>(<span class="ruby-identifier">value</span>)
|
|
547
|
+
178: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">value</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span>
|
|
548
|
+
179: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">adapter</span>.<span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">retrieve</span>(<span class="ruby-identifier">:marshall_method</span>, <span class="ruby-identifier">:none</span>).<span class="ruby-identifier">to_sym</span>
|
|
549
|
+
180: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:yaml</span>
|
|
550
|
+
181: <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">value</span>)
|
|
551
|
+
182: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:ruby</span>
|
|
552
|
+
183: <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">value</span>)
|
|
553
|
+
184: <span class="ruby-keyword kw">else</span>
|
|
554
|
+
185: <span class="ruby-identifier">value</span>
|
|
555
|
+
186: <span class="ruby-keyword kw">end</span>
|
|
556
|
+
187: <span class="ruby-keyword kw">end</span>
|
|
586
557
|
</pre>
|
|
587
558
|
</div>
|
|
588
559
|
</div>
|
|
589
560
|
</div>
|
|
590
561
|
|
|
591
|
-
<div id="method-
|
|
592
|
-
<a name="
|
|
562
|
+
<div id="method-M000057" class="method-detail">
|
|
563
|
+
<a name="M000057"></a>
|
|
593
564
|
|
|
594
565
|
<div class="method-heading">
|
|
595
|
-
<a href="#
|
|
566
|
+
<a href="#M000057" class="method-signature">
|
|
596
567
|
<span class="method-name">unsupported_adapters</span><span class="method-args">()</span>
|
|
597
568
|
</a>
|
|
598
569
|
</div>
|
|
@@ -600,18 +571,18 @@ href="../Adapters/Base.html">Cachetastic::Adapters::Base</a> for the cache.
|
|
|
600
571
|
<div class="method-description">
|
|
601
572
|
<p>
|
|
602
573
|
Returns an array of unsupported adapters for this cache. Defaults to an
|
|
603
|
-
empty array which will let any <a href="Base.html#
|
|
574
|
+
empty array which will let any <a href="Base.html#M000055">adapter</a> be
|
|
604
575
|
used by the cache. Override in your specific cache to prevent certain
|
|
605
576
|
adapters.
|
|
606
577
|
</p>
|
|
607
578
|
<p><a class="source-toggle" href="#"
|
|
608
|
-
onclick="toggleCode('
|
|
609
|
-
<div class="method-source-code" id="
|
|
579
|
+
onclick="toggleCode('M000057-source');return false;">[Source]</a></p>
|
|
580
|
+
<div class="method-source-code" id="M000057-source">
|
|
610
581
|
<pre>
|
|
611
|
-
<span class="ruby-comment cmt"># File lib/caches/
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
582
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 156</span>
|
|
583
|
+
156: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unsupported_adapters</span>
|
|
584
|
+
157: []
|
|
585
|
+
158: <span class="ruby-keyword kw">end</span>
|
|
615
586
|
</pre>
|
|
616
587
|
</div>
|
|
617
588
|
</div>
|
|
@@ -619,39 +590,39 @@ adapters.
|
|
|
619
590
|
|
|
620
591
|
<h3 class="section-bar">Private Class methods</h3>
|
|
621
592
|
|
|
622
|
-
<div id="method-
|
|
623
|
-
<a name="
|
|
593
|
+
<div id="method-M000061" class="method-detail">
|
|
594
|
+
<a name="M000061"></a>
|
|
624
595
|
|
|
625
596
|
<div class="method-heading">
|
|
626
|
-
<a href="#
|
|
597
|
+
<a href="#M000061" class="method-signature">
|
|
627
598
|
<span class="method-name">calculate_expiry_time</span><span class="method-args">(expiry)</span>
|
|
628
599
|
</a>
|
|
629
600
|
</div>
|
|
630
601
|
|
|
631
602
|
<div class="method-description">
|
|
632
603
|
<p>
|
|
633
|
-
If the expiry time is <a href="Base.html#
|
|
634
|
-
the expiry_swing time is <a href="Base.html#
|
|
604
|
+
If the expiry time is <a href="Base.html#M000050">set</a> to 60 minutes and
|
|
605
|
+
the expiry_swing time is <a href="Base.html#M000050">set</a> to 15 minutes,
|
|
635
606
|
this method will return a number between 45 minutes and 75 minutes.
|
|
636
607
|
</p>
|
|
637
608
|
<p><a class="source-toggle" href="#"
|
|
638
|
-
onclick="toggleCode('
|
|
639
|
-
<div class="method-source-code" id="
|
|
609
|
+
onclick="toggleCode('M000061-source');return false;">[Source]</a></p>
|
|
610
|
+
<div class="method-source-code" id="M000061-source">
|
|
640
611
|
<pre>
|
|
641
|
-
<span class="ruby-comment cmt"># File lib/caches/
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
612
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 192</span>
|
|
613
|
+
192: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">calculate_expiry_time</span>(<span class="ruby-identifier">expiry</span>) <span class="ruby-comment cmt"># :doc:</span>
|
|
614
|
+
193: <span class="ruby-identifier">exp_swing</span> = <span class="ruby-identifier">adapter</span>.<span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">retrieve</span>(<span class="ruby-identifier">:expiry_swing</span>, <span class="ruby-value">0</span>)
|
|
615
|
+
194: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exp_swing</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">exp_swing</span> <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
|
|
616
|
+
195: <span class="ruby-identifier">swing</span> = <span class="ruby-identifier">rand</span>(<span class="ruby-identifier">exp_swing</span>.<span class="ruby-identifier">to_i</span>)
|
|
617
|
+
196: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">rand</span>(<span class="ruby-value">2</span>)
|
|
618
|
+
197: <span class="ruby-keyword kw">when</span> <span class="ruby-value">0</span>
|
|
619
|
+
198: <span class="ruby-identifier">expiry</span> = (<span class="ruby-identifier">expiry</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">swing</span>)
|
|
620
|
+
199: <span class="ruby-keyword kw">when</span> <span class="ruby-value">1</span>
|
|
621
|
+
200: <span class="ruby-identifier">expiry</span> = (<span class="ruby-identifier">expiry</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">swing</span>)
|
|
622
|
+
201: <span class="ruby-keyword kw">end</span>
|
|
623
|
+
202: <span class="ruby-keyword kw">end</span>
|
|
624
|
+
203: <span class="ruby-identifier">expiry</span>
|
|
625
|
+
204: <span class="ruby-keyword kw">end</span>
|
|
655
626
|
</pre>
|
|
656
627
|
</div>
|
|
657
628
|
</div>
|