cachetastic 1.1.3 → 1.1.8
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 +3 -1
- data/doc/classes/ActiveRecord/Base.html +22 -2
- data/doc/classes/ActiveRecord/Base.src/M000001.html +1 -1
- data/doc/classes/ActiveRecord/Base.src/M000002.html +1 -1
- data/doc/classes/ActiveRecord/Base.src/M000003.html +1 -1
- data/doc/classes/ActiveRecord/Base.src/M000004.html +1 -1
- data/doc/classes/ActiveRecord/Base.src/M000005.html +1 -1
- data/doc/classes/{Cachetastic/Stores.html → CGI/Session/CachetasticStore.html} +23 -14
- data/doc/classes/Cachetastic/Caches/Base/RegisteredCaches.html +17 -6
- data/doc/classes/Cachetastic/Caches/Base/RegisteredCaches.src/{M000044.html → M000043.html} +1 -1
- data/doc/classes/Cachetastic/Caches/Base.html +148 -54
- data/doc/classes/Cachetastic/Caches/Base.src/{M000043.html → M000032.html} +4 -4
- data/doc/classes/Cachetastic/Caches/Base.src/M000033.html +14 -4
- data/doc/classes/Cachetastic/Caches/Base.src/M000034.html +9 -6
- data/doc/classes/Cachetastic/Caches/Base.src/M000035.html +5 -13
- data/doc/classes/Cachetastic/Caches/Base.src/M000036.html +5 -18
- data/doc/classes/Cachetastic/Caches/Base.src/M000037.html +4 -6
- data/doc/classes/Cachetastic/Caches/Base.src/M000038.html +4 -5
- data/doc/classes/Cachetastic/Caches/Base.src/M000039.html +4 -4
- data/doc/classes/Cachetastic/Caches/Base.src/M000040.html +4 -4
- data/doc/classes/Cachetastic/Caches/Base.src/M000041.html +4 -4
- data/doc/classes/Cachetastic/Caches/Base.src/M000042.html +14 -4
- data/doc/classes/Cachetastic/Caches/PageCache.html +8 -0
- data/doc/classes/Cachetastic/Caches/RailsSessionCache.html +6 -0
- data/doc/classes/Cachetastic/Connection.html +14 -14
- data/doc/classes/Cachetastic/Connection.src/M000044.html +18 -0
- data/doc/classes/Cachetastic/Connection.src/M000045.html +10 -4
- data/doc/classes/Cachetastic/Logger.html +5 -5
- data/doc/classes/Cachetastic/Stores/Base.html +68 -45
- data/doc/classes/Cachetastic/Stores/Base.src/{M000028.html → M000023.html} +1 -1
- data/doc/classes/Cachetastic/Stores/Base.src/{M000030.html → M000024.html} +1 -1
- data/doc/classes/Cachetastic/Stores/Base.src/{M000032.html → M000025.html} +1 -1
- data/doc/classes/Cachetastic/Stores/File.html +265 -0
- data/doc/classes/Cachetastic/Stores/File.src/M000026.html +18 -0
- data/doc/classes/Cachetastic/Stores/File.src/M000027.html +20 -0
- data/doc/classes/Cachetastic/Stores/File.src/M000028.html +19 -0
- data/doc/classes/Cachetastic/Stores/File.src/M000029.html +33 -0
- data/doc/classes/Cachetastic/Stores/File.src/M000030.html +21 -0
- data/doc/classes/Cachetastic/Stores/{LocalMemory.src/M000025.html → File.src/M000031.html} +3 -3
- data/doc/classes/Cachetastic/Stores/LocalMemory.html +41 -36
- data/doc/classes/Cachetastic/Stores/{Base.src/M000029.html → LocalMemory.src/M000017.html} +3 -3
- data/doc/classes/Cachetastic/Stores/LocalMemory.src/M000018.html +18 -0
- data/doc/classes/Cachetastic/Stores/LocalMemory.src/M000019.html +18 -0
- data/doc/classes/Cachetastic/Stores/LocalMemory.src/M000020.html +12 -4
- data/doc/classes/Cachetastic/Stores/LocalMemory.src/M000021.html +4 -4
- data/doc/classes/Cachetastic/Stores/LocalMemory.src/M000022.html +11 -4
- data/doc/classes/Cachetastic/Stores/Memcache.html +85 -59
- data/doc/classes/Cachetastic/Stores/Memcache.src/M000006.html +19 -0
- data/doc/classes/Cachetastic/Stores/{LocalMemory.src/M000024.html → Memcache.src/M000007.html} +3 -3
- data/doc/classes/Cachetastic/Stores/Memcache.src/M000008.html +18 -0
- data/doc/classes/Cachetastic/Stores/Memcache.src/M000009.html +4 -5
- data/doc/classes/Cachetastic/Stores/Memcache.src/M000010.html +4 -4
- data/doc/classes/Cachetastic/Stores/Memcache.src/M000011.html +4 -4
- data/doc/classes/Cachetastic/Stores/Memcache.src/M000012.html +10 -4
- data/doc/classes/Cachetastic/Stores/Memcache.src/M000013.html +5 -4
- data/doc/classes/Cachetastic/Stores/Memcache.src/M000014.html +6 -4
- data/doc/classes/Cachetastic/Stores/Memcache.src/M000015.html +6 -5
- data/doc/classes/Cachetastic/Stores/Memcache.src/M000016.html +9 -9
- data/doc/created.rid +1 -1
- data/doc/files/init_rb.html +111 -1
- data/doc/files/lib/caches/cachetastic_caches_base_rb.html +1 -1
- data/doc/files/lib/caches/cachetastic_caches_page_cache_rb.html +9 -1
- data/doc/files/lib/caches/cachetastic_caches_rails_session_cache_rb.html +7 -1
- data/doc/files/lib/cachetastic_connection_rb.html +1 -1
- data/doc/files/lib/cachetastic_rb.html +6 -2
- data/doc/files/lib/helpers/cachetastic_helpers_active_record_rb.html +1 -1
- data/doc/files/lib/rails_extensions/cachetastic_active_record_base_rb.html +1 -1
- data/doc/files/lib/rails_extensions/cgi_session_cachetastic_store_rb.html +1 -1
- data/doc/files/lib/stores/cachetastic_stores_base_rb.html +39 -1
- data/doc/{classes/ActiveRecord.html → files/lib/stores/cachetastic_stores_file_rb.html} +36 -22
- data/doc/files/lib/stores/cachetastic_stores_local_memory_rb.html +9 -1
- data/doc/files/lib/stores/cachetastic_stores_memcache_rb.html +27 -1
- data/doc/{classes/Cachetastic/Caches/ActiveRecord.html → files/lib/stores/cachetastic_stores_store_object_rb.html} +15 -19
- data/doc/fr_class_index.html +2 -8
- data/doc/fr_file_index.html +2 -0
- data/doc/fr_method_index.html +41 -42
- data/doc/index.html +2 -2
- data/init.rb +1 -0
- data/lib/caches/cachetastic_caches_base.rb +81 -18
- data/lib/caches/cachetastic_caches_page_cache.rb +4 -0
- data/lib/caches/cachetastic_caches_rails_session_cache.rb +1 -0
- data/lib/cachetastic.rb +10 -6
- data/lib/cachetastic_connection.rb +2 -2
- data/lib/helpers/cachetastic_helpers_active_record.rb +12 -1
- data/lib/rails_extensions/cachetastic_active_record_base.rb +10 -0
- data/lib/rails_extensions/cgi_session_cachetastic_store.rb +15 -10
- data/lib/stores/cachetastic_stores_base.rb +33 -13
- data/lib/stores/cachetastic_stores_file.rb +101 -0
- data/lib/stores/cachetastic_stores_local_memory.rb +6 -27
- data/lib/stores/cachetastic_stores_memcache.rb +24 -5
- data/lib/stores/cachetastic_stores_store_object.rb +28 -0
- data/lib/tasks/rubyforge_config.yml +1 -1
- metadata +28 -32
- data/doc/classes/Cachetastic/Caches.html +0 -114
- data/doc/classes/Cachetastic/Connection.src/M000046.html +0 -24
- data/doc/classes/Cachetastic/Helpers/ActiveRecord.html +0 -165
- data/doc/classes/Cachetastic/Helpers/ActiveRecord.src/M000006.html +0 -29
- data/doc/classes/Cachetastic/Helpers/ActiveRecord.src/M000007.html +0 -23
- data/doc/classes/Cachetastic/Helpers/ActiveRecord.src/M000008.html +0 -18
- data/doc/classes/Cachetastic/Helpers.html +0 -115
- data/doc/classes/Cachetastic/Stores/Base.src/M000031.html +0 -22
- data/doc/classes/Cachetastic/Stores/LocalMemory/StoreObject.html +0 -177
- data/doc/classes/Cachetastic/Stores/LocalMemory/StoreObject.src/M000026.html +0 -27
- data/doc/classes/Cachetastic/Stores/LocalMemory/StoreObject.src/M000027.html +0 -19
- data/doc/classes/Cachetastic/Stores/LocalMemory.src/M000023.html +0 -26
- data/doc/classes/Cachetastic/Stores/Memcache.src/M000017.html +0 -20
- data/doc/classes/Cachetastic/Stores/Memcache.src/M000018.html +0 -20
- data/doc/classes/Cachetastic/Stores/Memcache.src/M000019.html +0 -24
- data/doc/classes/Cachetastic.html +0 -119
- /data/doc/classes/Cachetastic/Logger.src/{M000047.html → M000046.html} +0 -0
data/README
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
debug: true # true | false (default: false)
|
|
12
12
|
# this is the type of file store to be used for this cache.
|
|
13
13
|
# more stores can be developed and plugged in as desired
|
|
14
|
-
store: local_memory # local_memory | memcache (default: local_memory)
|
|
14
|
+
store: local_memory # local_memory | memcache | file (default: local_memory)
|
|
15
15
|
# this will marshall objects into and out of the store.
|
|
16
16
|
# so far yaml is the only supported marshall format.
|
|
17
17
|
marshall_method: none # none | yaml (default: none)
|
|
@@ -29,6 +29,8 @@
|
|
|
29
29
|
debug: false
|
|
30
30
|
readonly: false
|
|
31
31
|
urlencode: false
|
|
32
|
+
store_options: # listed below are the options for file
|
|
33
|
+
dir: /cachetastic/caches/ # absolute path to the directory where caches should be stored.
|
|
32
34
|
# configure logging for this cache:
|
|
33
35
|
logging:
|
|
34
36
|
# n number of logs can be configured for a cache
|
|
@@ -102,8 +102,8 @@
|
|
|
102
102
|
<h3 class="section-bar">Included Modules</h3>
|
|
103
103
|
|
|
104
104
|
<div id="includes-list">
|
|
105
|
-
<span class="include-name"
|
|
106
|
-
<span class="include-name"
|
|
105
|
+
<span class="include-name">Cachetastic::Helpers::ActiveRecord</span>
|
|
106
|
+
<span class="include-name">Cachetastic::Helpers::ActiveRecord</span>
|
|
107
107
|
</div>
|
|
108
108
|
</div>
|
|
109
109
|
|
|
@@ -131,6 +131,9 @@
|
|
|
131
131
|
</div>
|
|
132
132
|
|
|
133
133
|
<div class="method-description">
|
|
134
|
+
<p>
|
|
135
|
+
Deletes an object from the cache for a given key.
|
|
136
|
+
</p>
|
|
134
137
|
</div>
|
|
135
138
|
</div>
|
|
136
139
|
|
|
@@ -145,6 +148,12 @@
|
|
|
145
148
|
</div>
|
|
146
149
|
|
|
147
150
|
<div class="method-description">
|
|
151
|
+
<p>
|
|
152
|
+
Returns an object from the cache for a given key. If the object returned is
|
|
153
|
+
nil and the self_populate parameter is true then the key will be used to
|
|
154
|
+
try and find the object in the database, set the object into the cache, and
|
|
155
|
+
then return the object.
|
|
156
|
+
</p>
|
|
148
157
|
</div>
|
|
149
158
|
</div>
|
|
150
159
|
|
|
@@ -159,6 +168,9 @@
|
|
|
159
168
|
</div>
|
|
160
169
|
|
|
161
170
|
<div class="method-description">
|
|
171
|
+
<p>
|
|
172
|
+
Sets an object into the cache for a given key.
|
|
173
|
+
</p>
|
|
162
174
|
</div>
|
|
163
175
|
</div>
|
|
164
176
|
|
|
@@ -175,6 +187,10 @@
|
|
|
175
187
|
</div>
|
|
176
188
|
|
|
177
189
|
<div class="method-description">
|
|
190
|
+
<p>
|
|
191
|
+
Unless the object is a new ActiveRecord object this method will store the
|
|
192
|
+
object in the cache using the object‘s ID as the key.
|
|
193
|
+
</p>
|
|
178
194
|
</div>
|
|
179
195
|
</div>
|
|
180
196
|
|
|
@@ -189,6 +205,10 @@
|
|
|
189
205
|
</div>
|
|
190
206
|
|
|
191
207
|
<div class="method-description">
|
|
208
|
+
<p>
|
|
209
|
+
Unless the object is a new ActiveRecord object this method will delete the
|
|
210
|
+
object in the cache using the object‘s ID as the key.
|
|
211
|
+
</p>
|
|
192
212
|
</div>
|
|
193
213
|
</div>
|
|
194
214
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/rails_extensions/cachetastic_active_record_base.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/rails_extensions/cachetastic_active_record_base.rb, line 12</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_from_cache</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">self_populate</span> = <span class="ruby-keyword kw">false</span>)
|
|
15
15
|
<span class="ruby-identifier">res</span> = <span class="ruby-identifier">cache_class</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">key</span>)
|
|
16
16
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">self_populate</span>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/rails_extensions/cachetastic_active_record_base.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/rails_extensions/cachetastic_active_record_base.rb, line 24</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete_from_cache</span>(<span class="ruby-identifier">key</span>)
|
|
15
15
|
<span class="ruby-identifier">cache_class</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>)
|
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/rails_extensions/cachetastic_active_record_base.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/rails_extensions/cachetastic_active_record_base.rb, line 29</span>
|
|
14
14
|
<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>)
|
|
15
15
|
<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>)
|
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/rails_extensions/cachetastic_active_record_base.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/rails_extensions/cachetastic_active_record_base.rb, line 37</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cache_self</span>
|
|
15
15
|
<span class="ruby-identifier">cache_class</span>.<span class="ruby-identifier">set</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">id</span>, <span class="ruby-keyword kw">self</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new_record?</span>
|
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/rails_extensions/cachetastic_active_record_base.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/rails_extensions/cachetastic_active_record_base.rb, line 43</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">uncache_self</span>
|
|
15
15
|
<span class="ruby-identifier">cache_class</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">id</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new_record?</span>
|
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
7
|
<head>
|
|
8
|
-
<title>
|
|
8
|
+
<title>Class: CGI::Session::CachetasticStore</title>
|
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
10
|
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
-
<link rel="stylesheet" href="
|
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
12
12
|
<script type="text/javascript">
|
|
13
13
|
// <![CDATA[
|
|
14
14
|
|
|
@@ -49,19 +49,25 @@
|
|
|
49
49
|
<div id="classHeader">
|
|
50
50
|
<table class="header-table">
|
|
51
51
|
<tr class="top-aligned-row">
|
|
52
|
-
<td><strong>
|
|
53
|
-
<td class="class-name-in-header">
|
|
52
|
+
<td><strong>Class</strong></td>
|
|
53
|
+
<td class="class-name-in-header">CGI::Session::CachetasticStore</td>
|
|
54
54
|
</tr>
|
|
55
55
|
<tr class="top-aligned-row">
|
|
56
56
|
<td><strong>In:</strong></td>
|
|
57
57
|
<td>
|
|
58
|
-
<a href="
|
|
59
|
-
lib/
|
|
58
|
+
<a href="../../../files/lib/rails_extensions/cgi_session_cachetastic_store_rb.html">
|
|
59
|
+
lib/rails_extensions/cgi_session_cachetastic_store.rb
|
|
60
60
|
</a>
|
|
61
61
|
<br />
|
|
62
62
|
</td>
|
|
63
63
|
</tr>
|
|
64
64
|
|
|
65
|
+
<tr class="top-aligned-row">
|
|
66
|
+
<td><strong>Parent:</strong></td>
|
|
67
|
+
<td>
|
|
68
|
+
Object
|
|
69
|
+
</td>
|
|
70
|
+
</tr>
|
|
65
71
|
</table>
|
|
66
72
|
</div>
|
|
67
73
|
<!-- banner header -->
|
|
@@ -72,6 +78,17 @@
|
|
|
72
78
|
|
|
73
79
|
<div id="contextContent">
|
|
74
80
|
|
|
81
|
+
<div id="description">
|
|
82
|
+
<p>
|
|
83
|
+
Allows Rails to use Cachetastic for it‘s session store. The setting
|
|
84
|
+
below needs to happen AFTER the gem has been required, obviously! In Rails
|
|
85
|
+
1.2.6 this is AFTER the initializer block.
|
|
86
|
+
</p>
|
|
87
|
+
<pre>
|
|
88
|
+
ActionController::Base.session_store = :cachetastic_store
|
|
89
|
+
</pre>
|
|
90
|
+
|
|
91
|
+
</div>
|
|
75
92
|
|
|
76
93
|
|
|
77
94
|
</div>
|
|
@@ -84,14 +101,6 @@
|
|
|
84
101
|
|
|
85
102
|
<div id="section">
|
|
86
103
|
|
|
87
|
-
<div id="class-list">
|
|
88
|
-
<h3 class="section-bar">Classes and Modules</h3>
|
|
89
|
-
|
|
90
|
-
Class <a href="Stores/Base.html" class="link">Cachetastic::Stores::Base</a><br />
|
|
91
|
-
Class <a href="Stores/LocalMemory.html" class="link">Cachetastic::Stores::LocalMemory</a><br />
|
|
92
|
-
Class <a href="Stores/Memcache.html" class="link">Cachetastic::Stores::Memcache</a><br />
|
|
93
|
-
|
|
94
|
-
</div>
|
|
95
104
|
|
|
96
105
|
|
|
97
106
|
|
|
@@ -78,6 +78,14 @@
|
|
|
78
78
|
|
|
79
79
|
<div id="contextContent">
|
|
80
80
|
|
|
81
|
+
<div id="description">
|
|
82
|
+
<p>
|
|
83
|
+
Used to store a list of all the caches registered with the system. In order
|
|
84
|
+
for a cache to be registered it must extend <a
|
|
85
|
+
href="../Base.html">Cachetastic::Caches::Base</a>.
|
|
86
|
+
</p>
|
|
87
|
+
|
|
88
|
+
</div>
|
|
81
89
|
|
|
82
90
|
|
|
83
91
|
</div>
|
|
@@ -86,7 +94,7 @@
|
|
|
86
94
|
<h3 class="section-bar">Methods</h3>
|
|
87
95
|
|
|
88
96
|
<div class="name-list">
|
|
89
|
-
<a href="#
|
|
97
|
+
<a href="#M000043">new</a>
|
|
90
98
|
</div>
|
|
91
99
|
</div>
|
|
92
100
|
|
|
@@ -116,7 +124,10 @@
|
|
|
116
124
|
<tr class="top-aligned-row context-row">
|
|
117
125
|
<td class="context-item-name">list</td>
|
|
118
126
|
<td class="context-item-value"> [R] </td>
|
|
119
|
-
<td class="context-item-desc"
|
|
127
|
+
<td class="context-item-desc">
|
|
128
|
+
list of all caches registered with the system.
|
|
129
|
+
|
|
130
|
+
</td>
|
|
120
131
|
</tr>
|
|
121
132
|
</table>
|
|
122
133
|
</div>
|
|
@@ -128,12 +139,12 @@
|
|
|
128
139
|
<div id="methods">
|
|
129
140
|
<h3 class="section-bar">Public Class methods</h3>
|
|
130
141
|
|
|
131
|
-
<div id="method-
|
|
132
|
-
<a name="
|
|
142
|
+
<div id="method-M000043" class="method-detail">
|
|
143
|
+
<a name="M000043"></a>
|
|
133
144
|
|
|
134
145
|
<div class="method-heading">
|
|
135
|
-
<a href="RegisteredCaches.src/
|
|
136
|
-
onclick="popupCode('RegisteredCaches.src/
|
|
146
|
+
<a href="RegisteredCaches.src/M000043.html" target="Code" class="method-signature"
|
|
147
|
+
onclick="popupCode('RegisteredCaches.src/M000043.html');return false;">
|
|
137
148
|
<span class="method-name">new</span><span class="method-args">()</span>
|
|
138
149
|
</a>
|
|
139
150
|
</div>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/caches/cachetastic_caches_base.rb, line
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/caches/cachetastic_caches_base.rb, line 37</span>
|
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
|
|
15
15
|
<span class="ruby-ivar">@list</span> = []
|
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
|
@@ -78,6 +78,38 @@
|
|
|
78
78
|
|
|
79
79
|
<div id="contextContent">
|
|
80
80
|
|
|
81
|
+
<div id="description">
|
|
82
|
+
<p>
|
|
83
|
+
When creating a new ‘Cache’ this class should be extended. Once
|
|
84
|
+
extended you‘ll only need to override just the methods that are
|
|
85
|
+
different for your cache.
|
|
86
|
+
</p>
|
|
87
|
+
<pre>
|
|
88
|
+
class MyAwesomeCache < Cachetastic::Caches::Base
|
|
89
|
+
end
|
|
90
|
+
MyAwesomeCache.set(1, "One")
|
|
91
|
+
MyAwesomeCache.get(1) # => "One"
|
|
92
|
+
MyAwesomeCache.update(1, "One!!")
|
|
93
|
+
MyAwesomeCache.get(1) # => "One!!"
|
|
94
|
+
MyAwesomeCache.delete(1)
|
|
95
|
+
MyAwesomeCache.get(1) # => nil
|
|
96
|
+
|
|
97
|
+
class MyAwesomeCache < Cachetastic::Caches::Base
|
|
98
|
+
class << self
|
|
99
|
+
def get(key)
|
|
100
|
+
super(key) do
|
|
101
|
+
set(key, key * 10)
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
MyAwesomeCache.set(1, "One")
|
|
107
|
+
MyAwesomeCache.get(1) # => "One"
|
|
108
|
+
MyAwesomeCache.delete(1)
|
|
109
|
+
MyAwesomeCache.get(1) # => 10
|
|
110
|
+
</pre>
|
|
111
|
+
|
|
112
|
+
</div>
|
|
81
113
|
|
|
82
114
|
|
|
83
115
|
</div>
|
|
@@ -86,17 +118,17 @@
|
|
|
86
118
|
<h3 class="section-bar">Methods</h3>
|
|
87
119
|
|
|
88
120
|
<div class="name-list">
|
|
89
|
-
<a href="#
|
|
90
|
-
<a href="#
|
|
91
|
-
<a href="#
|
|
92
|
-
<a href="#
|
|
93
|
-
<a href="#
|
|
94
|
-
<a href="#
|
|
95
|
-
<a href="#
|
|
96
|
-
<a href="#
|
|
97
|
-
<a href="#
|
|
98
|
-
<a href="#
|
|
99
|
-
<a href="#
|
|
121
|
+
<a href="#M000032">all_registered_caches</a>
|
|
122
|
+
<a href="#M000039">cache_name</a>
|
|
123
|
+
<a href="#M000042">calculate_expiry_time</a>
|
|
124
|
+
<a href="#M000035">delete</a>
|
|
125
|
+
<a href="#M000036">expire_all</a>
|
|
126
|
+
<a href="#M000033">get</a>
|
|
127
|
+
<a href="#M000041">logger</a>
|
|
128
|
+
<a href="#M000037">populate_all</a>
|
|
129
|
+
<a href="#M000034">set</a>
|
|
130
|
+
<a href="#M000038">stats</a>
|
|
131
|
+
<a href="#M000040">store</a>
|
|
100
132
|
</div>
|
|
101
133
|
</div>
|
|
102
134
|
|
|
@@ -137,129 +169,180 @@
|
|
|
137
169
|
<div id="methods">
|
|
138
170
|
<h3 class="section-bar">Public Class methods</h3>
|
|
139
171
|
|
|
140
|
-
<div id="method-
|
|
141
|
-
<a name="
|
|
172
|
+
<div id="method-M000032" class="method-detail">
|
|
173
|
+
<a name="M000032"></a>
|
|
142
174
|
|
|
143
175
|
<div class="method-heading">
|
|
144
|
-
<a href="Base.src/
|
|
145
|
-
onclick="popupCode('Base.src/
|
|
176
|
+
<a href="Base.src/M000032.html" target="Code" class="method-signature"
|
|
177
|
+
onclick="popupCode('Base.src/M000032.html');return false;">
|
|
146
178
|
<span class="method-name">all_registered_caches</span><span class="method-args">()</span>
|
|
147
179
|
</a>
|
|
148
180
|
</div>
|
|
149
181
|
|
|
150
182
|
<div class="method-description">
|
|
183
|
+
<p>
|
|
184
|
+
Returns a list of all registered caches in the system.
|
|
185
|
+
</p>
|
|
151
186
|
</div>
|
|
152
187
|
</div>
|
|
153
188
|
|
|
154
|
-
<div id="method-
|
|
155
|
-
<a name="
|
|
189
|
+
<div id="method-M000039" class="method-detail">
|
|
190
|
+
<a name="M000039"></a>
|
|
156
191
|
|
|
157
192
|
<div class="method-heading">
|
|
158
|
-
<a href="Base.src/
|
|
159
|
-
onclick="popupCode('Base.src/
|
|
193
|
+
<a href="Base.src/M000039.html" target="Code" class="method-signature"
|
|
194
|
+
onclick="popupCode('Base.src/M000039.html');return false;">
|
|
160
195
|
<span class="method-name">cache_name</span><span class="method-args">()</span>
|
|
161
196
|
</a>
|
|
162
197
|
</div>
|
|
163
198
|
|
|
164
199
|
<div class="method-description">
|
|
200
|
+
<p>
|
|
201
|
+
Returns a ‘methodize’ version of the cache‘s class name.
|
|
202
|
+
This gets used in logging, namespacing, and as the key in the <a
|
|
203
|
+
href="../Connection.html">Cachetastic::Connection</a> class.
|
|
204
|
+
</p>
|
|
205
|
+
<pre>
|
|
206
|
+
MyAwesomeCache.cache # => "my_awesome_cache"
|
|
207
|
+
Cachetastic::Caches::Base # => "cachetastic_caches_base"
|
|
208
|
+
</pre>
|
|
165
209
|
</div>
|
|
166
210
|
</div>
|
|
167
211
|
|
|
168
|
-
<div id="method-
|
|
169
|
-
<a name="
|
|
212
|
+
<div id="method-M000035" class="method-detail">
|
|
213
|
+
<a name="M000035"></a>
|
|
170
214
|
|
|
171
215
|
<div class="method-heading">
|
|
172
|
-
<a href="Base.src/
|
|
173
|
-
onclick="popupCode('Base.src/
|
|
216
|
+
<a href="Base.src/M000035.html" target="Code" class="method-signature"
|
|
217
|
+
onclick="popupCode('Base.src/M000035.html');return false;">
|
|
174
218
|
<span class="method-name">delete</span><span class="method-args">(key, delay = 0)</span>
|
|
175
219
|
</a>
|
|
176
220
|
</div>
|
|
177
221
|
|
|
178
222
|
<div class="method-description">
|
|
223
|
+
<p>
|
|
224
|
+
Deletes an object from the cache. The optional delay parameter sets an
|
|
225
|
+
offset, in seconds, for when the object should <a
|
|
226
|
+
href="Base.html#M000033">get</a> deleted. The default of 0 means the object
|
|
227
|
+
gets deleted right away.
|
|
228
|
+
</p>
|
|
179
229
|
</div>
|
|
180
230
|
</div>
|
|
181
231
|
|
|
182
|
-
<div id="method-
|
|
183
|
-
<a name="
|
|
232
|
+
<div id="method-M000036" class="method-detail">
|
|
233
|
+
<a name="M000036"></a>
|
|
184
234
|
|
|
185
235
|
<div class="method-heading">
|
|
186
|
-
<a href="Base.src/
|
|
187
|
-
onclick="popupCode('Base.src/
|
|
236
|
+
<a href="Base.src/M000036.html" target="Code" class="method-signature"
|
|
237
|
+
onclick="popupCode('Base.src/M000036.html');return false;">
|
|
188
238
|
<span class="method-name">expire_all</span><span class="method-args">()</span>
|
|
189
239
|
</a>
|
|
190
240
|
</div>
|
|
191
241
|
|
|
192
242
|
<div class="method-description">
|
|
243
|
+
<p>
|
|
244
|
+
Expires all objects for this cache.
|
|
245
|
+
</p>
|
|
193
246
|
</div>
|
|
194
247
|
</div>
|
|
195
248
|
|
|
196
|
-
<div id="method-
|
|
197
|
-
<a name="
|
|
249
|
+
<div id="method-M000033" class="method-detail">
|
|
250
|
+
<a name="M000033"></a>
|
|
198
251
|
|
|
199
252
|
<div class="method-heading">
|
|
200
|
-
<a href="Base.src/
|
|
201
|
-
onclick="popupCode('Base.src/
|
|
202
|
-
<span class="method-name">get</span><span class="method-args">(key) {|if block_given?| ...}</span>
|
|
253
|
+
<a href="Base.src/M000033.html" target="Code" class="method-signature"
|
|
254
|
+
onclick="popupCode('Base.src/M000033.html');return false;">
|
|
255
|
+
<span class="method-name">get</span><span class="method-args">(key) {|key if block_given?| ...}</span>
|
|
203
256
|
</a>
|
|
204
257
|
</div>
|
|
205
258
|
|
|
206
259
|
<div class="method-description">
|
|
260
|
+
<p>
|
|
261
|
+
Returns an object from the cache for a given key. If the object comes back
|
|
262
|
+
as nil and a block is given that block will be run and the results of the
|
|
263
|
+
block will be run. This can be used to JIT caches, just make sure in the
|
|
264
|
+
block to call the <a href="Base.html#M000034">set</a> method because the
|
|
265
|
+
results of the block are not automatically cached.
|
|
266
|
+
</p>
|
|
207
267
|
</div>
|
|
208
268
|
</div>
|
|
209
269
|
|
|
210
|
-
<div id="method-
|
|
211
|
-
<a name="
|
|
270
|
+
<div id="method-M000041" class="method-detail">
|
|
271
|
+
<a name="M000041"></a>
|
|
212
272
|
|
|
213
273
|
<div class="method-heading">
|
|
214
|
-
<a href="Base.src/
|
|
215
|
-
onclick="popupCode('Base.src/
|
|
216
|
-
<span class="method-name">
|
|
274
|
+
<a href="Base.src/M000041.html" target="Code" class="method-signature"
|
|
275
|
+
onclick="popupCode('Base.src/M000041.html');return false;">
|
|
276
|
+
<span class="method-name">logger</span><span class="method-args">()</span>
|
|
217
277
|
</a>
|
|
218
278
|
</div>
|
|
219
279
|
|
|
220
280
|
<div class="method-description">
|
|
281
|
+
<p>
|
|
282
|
+
Returns the <a href="../Logger.html">Cachetastic::Logger</a> for the
|
|
283
|
+
underlying <a href="../Stores/Base.html">Cachetastic::Stores::Base</a>.
|
|
284
|
+
</p>
|
|
221
285
|
</div>
|
|
222
286
|
</div>
|
|
223
287
|
|
|
224
|
-
<div id="method-
|
|
225
|
-
<a name="
|
|
288
|
+
<div id="method-M000037" class="method-detail">
|
|
289
|
+
<a name="M000037"></a>
|
|
226
290
|
|
|
227
291
|
<div class="method-heading">
|
|
228
|
-
<a href="Base.src/
|
|
229
|
-
onclick="popupCode('Base.src/
|
|
230
|
-
<span class="method-name">
|
|
292
|
+
<a href="Base.src/M000037.html" target="Code" class="method-signature"
|
|
293
|
+
onclick="popupCode('Base.src/M000037.html');return false;">
|
|
294
|
+
<span class="method-name">populate_all</span><span class="method-args">()</span>
|
|
231
295
|
</a>
|
|
232
296
|
</div>
|
|
233
297
|
|
|
234
298
|
<div class="method-description">
|
|
299
|
+
<p>
|
|
300
|
+
Raises a MethodNotImplemented exception. This method should be overridden
|
|
301
|
+
in the child class to enable a populating the cache with all things that
|
|
302
|
+
should be in there.
|
|
303
|
+
</p>
|
|
235
304
|
</div>
|
|
236
305
|
</div>
|
|
237
306
|
|
|
238
|
-
<div id="method-
|
|
239
|
-
<a name="
|
|
307
|
+
<div id="method-M000034" class="method-detail">
|
|
308
|
+
<a name="M000034"></a>
|
|
240
309
|
|
|
241
310
|
<div class="method-heading">
|
|
242
|
-
<a href="Base.src/
|
|
243
|
-
onclick="popupCode('Base.src/
|
|
244
|
-
<span class="method-name">
|
|
311
|
+
<a href="Base.src/M000034.html" target="Code" class="method-signature"
|
|
312
|
+
onclick="popupCode('Base.src/M000034.html');return false;">
|
|
313
|
+
<span class="method-name">set</span><span class="method-args">(key, value, expiry = (store.all_options["default_expiry"] || 0))</span>
|
|
245
314
|
</a>
|
|
246
315
|
</div>
|
|
247
316
|
|
|
248
317
|
<div class="method-description">
|
|
318
|
+
<p>
|
|
319
|
+
Set a particular object info the cache for the given key. An optional third
|
|
320
|
+
parameter sets the expiry time for the object in the cache. The default for
|
|
321
|
+
this expiry is <a href="Base.html#M000034">set</a> as either 0, meaning it
|
|
322
|
+
never expires, or if there‘s a default_expiry time <a
|
|
323
|
+
href="Base.html#M000034">set</a> in the config file, that file will be
|
|
324
|
+
used. If there is an expiry_swing <a href="Base.html#M000034">set</a> in
|
|
325
|
+
the config file it will be +/- to the expiry time. See also: <a
|
|
326
|
+
href="Base.html#M000042">calculate_expiry_time</a>
|
|
327
|
+
</p>
|
|
249
328
|
</div>
|
|
250
329
|
</div>
|
|
251
330
|
|
|
252
|
-
<div id="method-
|
|
253
|
-
<a name="
|
|
331
|
+
<div id="method-M000038" class="method-detail">
|
|
332
|
+
<a name="M000038"></a>
|
|
254
333
|
|
|
255
334
|
<div class="method-heading">
|
|
256
|
-
<a href="Base.src/
|
|
257
|
-
onclick="popupCode('Base.src/
|
|
258
|
-
<span class="method-name">
|
|
335
|
+
<a href="Base.src/M000038.html" target="Code" class="method-signature"
|
|
336
|
+
onclick="popupCode('Base.src/M000038.html');return false;">
|
|
337
|
+
<span class="method-name">stats</span><span class="method-args">()</span>
|
|
259
338
|
</a>
|
|
260
339
|
</div>
|
|
261
340
|
|
|
262
341
|
<div class="method-description">
|
|
342
|
+
<p>
|
|
343
|
+
A convenience method that returns statistics for the underlying <a
|
|
344
|
+
href="../Stores/Base.html">Cachetastic::Stores::Base</a> for the cache.
|
|
345
|
+
</p>
|
|
263
346
|
</div>
|
|
264
347
|
</div>
|
|
265
348
|
|
|
@@ -269,25 +352,36 @@
|
|
|
269
352
|
<div class="method-heading">
|
|
270
353
|
<a href="Base.src/M000040.html" target="Code" class="method-signature"
|
|
271
354
|
onclick="popupCode('Base.src/M000040.html');return false;">
|
|
272
|
-
<span class="method-name">
|
|
355
|
+
<span class="method-name">store</span><span class="method-args">()</span>
|
|
273
356
|
</a>
|
|
274
357
|
</div>
|
|
275
358
|
|
|
276
359
|
<div class="method-description">
|
|
360
|
+
<p>
|
|
361
|
+
Returns the underlying <a
|
|
362
|
+
href="../Stores/Base.html">Cachetastic::Stores::Base</a> for this cache.
|
|
363
|
+
</p>
|
|
277
364
|
</div>
|
|
278
365
|
</div>
|
|
279
366
|
|
|
367
|
+
<h3 class="section-bar">Private Class methods</h3>
|
|
368
|
+
|
|
280
369
|
<div id="method-M000042" class="method-detail">
|
|
281
370
|
<a name="M000042"></a>
|
|
282
371
|
|
|
283
372
|
<div class="method-heading">
|
|
284
373
|
<a href="Base.src/M000042.html" target="Code" class="method-signature"
|
|
285
374
|
onclick="popupCode('Base.src/M000042.html');return false;">
|
|
286
|
-
<span class="method-name">
|
|
375
|
+
<span class="method-name">calculate_expiry_time</span><span class="method-args">(expiry)</span>
|
|
287
376
|
</a>
|
|
288
377
|
</div>
|
|
289
378
|
|
|
290
379
|
<div class="method-description">
|
|
380
|
+
<p>
|
|
381
|
+
If the expiry time is <a href="Base.html#M000034">set</a> to 60 minutes and
|
|
382
|
+
the expiry_swing time is <a href="Base.html#M000034">set</a> to 15 minutes,
|
|
383
|
+
this method will return a number between 45 minutes and 75 minutes.
|
|
384
|
+
</p>
|
|
291
385
|
</div>
|
|
292
386
|
</div>
|
|
293
387
|
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
<html>
|
|
7
7
|
<head>
|
|
8
|
-
<title>
|
|
8
|
+
<title>all_registered_caches (Cachetastic::Caches::Base)</title>
|
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
10
|
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/caches/cachetastic_caches_base.rb, line
|
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
|
15
|
-
<span class="ruby-identifier">
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/caches/cachetastic_caches_base.rb, line 48</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">all_registered_caches</span>
|
|
15
|
+
<span class="ruby-constant">RegisteredCaches</span>.<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">list</span>
|
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
|
17
17
|
</body>
|
|
18
18
|
</html>
|