cachetastic 2.1.4 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. data/LICENSE +21 -0
  2. data/README +57 -43
  3. data/doc/classes/Cachetastic/Adapters.html +180 -0
  4. data/doc/classes/Cachetastic/Adapters/Base.html +206 -123
  5. data/doc/classes/Cachetastic/Adapters/File.html +17 -130
  6. data/doc/classes/Cachetastic/Adapters/LocalMemory.html +7 -228
  7. data/doc/classes/Cachetastic/Adapters/Memcached.html +193 -0
  8. data/doc/classes/Cachetastic/Cache.html +425 -0
  9. data/doc/classes/Cachetastic/Cacheable.html +26 -30
  10. data/doc/classes/Cachetastic/Cacheable/ClassAndInstanceMethods.html +66 -62
  11. data/doc/classes/Cachetastic/Cacheable/ClassOnlyMethods.html +30 -30
  12. data/doc/classes/Cachetastic/Logger.html +31 -33
  13. data/doc/created.rid +1 -1
  14. data/doc/files/{lib/cachetastic/adapters/html_file_rb.html → LICENSE.html} +29 -34
  15. data/doc/files/README.html +91 -57
  16. data/doc/files/lib/cachetastic/adapters/base_rb.html +1 -39
  17. data/doc/files/lib/cachetastic/adapters/file_rb.html +1 -21
  18. data/doc/files/lib/cachetastic/adapters/local_memory_rb.html +1 -9
  19. data/doc/files/lib/cachetastic/{ruby_extensions/kernel_rb.html → adapters/memcached_rb.html} +4 -4
  20. data/doc/files/lib/cachetastic/{ruby_extensions/string_rb.html → cache_rb.html} +5 -5
  21. data/doc/files/lib/cachetastic/cacheable_rb.html +1 -1
  22. data/doc/files/lib/cachetastic/{caches/base_rb.html → extensions/string_rb.html} +5 -5
  23. data/doc/files/lib/cachetastic/logger_rb.html +1 -7
  24. data/doc/files/lib/cachetastic/{adapters/store_object_rb.html → store_object_rb.html} +3 -3
  25. data/doc/files/lib/cachetastic_rb.html +4 -95
  26. data/doc/fr_class_index.html +3 -15
  27. data/doc/fr_file_index.html +5 -16
  28. data/doc/fr_method_index.html +26 -78
  29. data/lib/cachetastic.rb +16 -70
  30. data/lib/cachetastic/adapters/base.rb +178 -76
  31. data/lib/cachetastic/adapters/file.rb +63 -46
  32. data/lib/cachetastic/adapters/local_memory.rb +36 -67
  33. data/lib/cachetastic/adapters/memcached.rb +114 -0
  34. data/lib/cachetastic/cache.rb +165 -0
  35. data/lib/cachetastic/cacheable.rb +19 -15
  36. data/lib/cachetastic/extensions/string.rb +8 -0
  37. data/lib/cachetastic/logger.rb +41 -41
  38. data/lib/cachetastic/store_object.rb +22 -0
  39. metadata +43 -64
  40. data/bin/cachetastic_drb_server +0 -115
  41. data/doc/classes/ActiveRecord/Base.html +0 -194
  42. data/doc/classes/CGI/Session/CachetasticStore.html +0 -124
  43. data/doc/classes/Cachetastic/Adapters/Drb.html +0 -332
  44. data/doc/classes/Cachetastic/Adapters/FileBase.html +0 -309
  45. data/doc/classes/Cachetastic/Adapters/HtmlFile.html +0 -224
  46. data/doc/classes/Cachetastic/Adapters/Memcache.html +0 -498
  47. data/doc/classes/Cachetastic/Caches/Base.html +0 -643
  48. data/doc/classes/Cachetastic/Caches/Base/RegisteredCaches.html +0 -179
  49. data/doc/classes/Cachetastic/Caches/MackSessionCache.html +0 -119
  50. data/doc/classes/Cachetastic/Caches/PageCache.html +0 -121
  51. data/doc/classes/Cachetastic/Caches/RailsSessionCache.html +0 -154
  52. data/doc/classes/Cachetastic/Connection.html +0 -212
  53. data/doc/classes/Cachetastic/Errors/UnsupportedAdapter.html +0 -146
  54. data/doc/classes/Object.html +0 -222
  55. data/doc/classes/String.html +0 -172
  56. data/doc/files/lib/cachetastic/adapters/drb_rb.html +0 -115
  57. data/doc/files/lib/cachetastic/adapters/file_base_rb.html +0 -109
  58. data/doc/files/lib/cachetastic/adapters/memcache_rb.html +0 -127
  59. data/doc/files/lib/cachetastic/caches/mack_session_cache_rb.html +0 -107
  60. data/doc/files/lib/cachetastic/caches/page_cache_rb.html +0 -109
  61. data/doc/files/lib/cachetastic/caches/rails_session_cache_rb.html +0 -107
  62. data/doc/files/lib/cachetastic/connection_rb.html +0 -107
  63. data/doc/files/lib/cachetastic/errors/unsupported_adapter_rb.html +0 -101
  64. data/doc/files/lib/cachetastic/rails_extensions/active_record_base_rb.html +0 -101
  65. data/doc/files/lib/cachetastic/rails_extensions/cgi_session_store_rb.html +0 -109
  66. data/doc/files/lib/cachetastic/ruby_extensions/object_rb.html +0 -101
  67. data/lib/cachetastic/adapters/drb.rb +0 -51
  68. data/lib/cachetastic/adapters/file_base.rb +0 -86
  69. data/lib/cachetastic/adapters/html_file.rb +0 -68
  70. data/lib/cachetastic/adapters/memcache.rb +0 -114
  71. data/lib/cachetastic/adapters/store_object.rb +0 -28
  72. data/lib/cachetastic/caches/base.rb +0 -238
  73. data/lib/cachetastic/caches/mack_session_cache.rb +0 -3
  74. data/lib/cachetastic/caches/page_cache.rb +0 -6
  75. data/lib/cachetastic/caches/rails_session_cache.rb +0 -12
  76. data/lib/cachetastic/connection.rb +0 -24
  77. data/lib/cachetastic/errors/unsupported_adapter.rb +0 -7
  78. data/lib/cachetastic/rails_extensions/active_record_base.rb +0 -24
  79. data/lib/cachetastic/rails_extensions/cgi_session_store.rb +0 -59
  80. data/lib/cachetastic/ruby_extensions/kernel.rb +0 -25
  81. data/lib/cachetastic/ruby_extensions/object.rb +0 -22
  82. data/lib/cachetastic/ruby_extensions/string.rb +0 -15
  83. data/test/active_record_test.rb +0 -89
  84. data/test/cacheable_test.rb +0 -88
  85. data/test/cachetastic_unit_test.rb +0 -74
  86. data/test/config.rb +0 -30
  87. data/test/drb_adapter_test.rb +0 -14
  88. data/test/file_adapter_test.rb +0 -49
  89. data/test/memcache_adapter_test.rb +0 -18
  90. data/test/test_helper.rb +0 -75
@@ -80,9 +80,9 @@
80
80
  <h3 class="section-bar">Methods</h3>
81
81
 
82
82
  <div class="name-list">
83
- <a href="#M000071">cache_class</a>&nbsp;&nbsp;
84
- <a href="#M000072">cacher</a>&nbsp;&nbsp;
85
- <a href="#M000073">expire_all</a>&nbsp;&nbsp;
83
+ <a href="#M000015">cache_class</a>&nbsp;&nbsp;
84
+ <a href="#M000016">cacher</a>&nbsp;&nbsp;
85
+ <a href="#M000017">expire_all</a>&nbsp;&nbsp;
86
86
  </div>
87
87
  </div>
88
88
 
@@ -104,69 +104,76 @@
104
104
  <div id="methods">
105
105
  <h3 class="section-bar">Public Instance methods</h3>
106
106
 
107
- <div id="method-M000071" class="method-detail">
108
- <a name="M000071"></a>
107
+ <div id="method-M000015" class="method-detail">
108
+ <a name="M000015"></a>
109
109
 
110
110
  <div class="method-heading">
111
- <a href="#M000071" class="method-signature">
111
+ <a href="#M000015" class="method-signature">
112
112
  <span class="method-name">cache_class</span><span class="method-args">()</span>
113
113
  </a>
114
114
  </div>
115
115
 
116
116
  <div class="method-description">
117
117
  <p>
118
- Returns the <a href="../Caches/Base.html">Cachetastic::Caches::Base</a>
119
- object associated with the object. If a cache hasn&#8216;t been defined the
120
- one will be created on the fly. The cache for the object is expected to be
118
+ Returns the <a href="../Cache.html">Cachetastic::Cache</a> object
119
+ associated with the object. If a cache hasn&#8216;t been defined the one
120
+ will be created on the fly. The cache for the object is expected to be
121
121
  defined as: <a
122
- href="../Cacheable.html">Cachetastic::Cacheable</a>::{CLASS_NAME_HERE}Cache
122
+ href="../Cacheable.html">Cachetastic::Cacheable</a>::{CLASS_NAME_HERE}<a
123
+ href="../Cache.html">Cache</a>
123
124
  </p>
124
125
  <p>
125
- Example:
126
+ Examples:
126
127
  </p>
127
128
  <pre>
128
129
  class Person
129
130
  include Cachetastic::Cacheable
130
- attr_accessor :name
131
- def cachetastic_key
132
- self.name
133
- end
134
131
  end
135
132
 
136
133
  Person.cache_class # =&gt; Cachetastic::Cacheable::PersonCache
134
+
135
+ class Admin::Person
136
+ include Cachetastic::Cacheable
137
+ end
138
+
139
+ Admin::Person.cache_class # =&gt; Cachetastic::Cacheable::Admin_PersonCache
137
140
  </pre>
138
141
  <p><a class="source-toggle" href="#"
139
- onclick="toggleCode('M000071-source');return false;">[Source]</a></p>
140
- <div class="method-source-code" id="M000071-source">
142
+ onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
143
+ <div class="method-source-code" id="M000015-source">
141
144
  <pre>
142
- <span class="ruby-comment cmt"># File lib/cachetastic/cacheable.rb, line 39</span>
143
- 39: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cache_class</span>
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
- 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">&quot;Class&quot;</span>
146
- 42: <span class="ruby-identifier">n</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-value str">'::'</span>, <span class="ruby-value str">'_'</span>)
147
- 43: <span class="ruby-identifier">c_name</span> = <span class="ruby-node">&quot;Cachetastic::Cacheable::#{n}Cache&quot;</span>
148
- 44: <span class="ruby-keyword kw">begin</span>
149
- 45: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">c_name</span>.<span class="ruby-identifier">constantize</span>
150
- 46: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">NameError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
151
- 47: <span class="ruby-identifier">eval</span> <span class="ruby-node">%{
152
- 48: class #{c_name} &lt; Cachetastic::Caches::Base
153
- 49: end
154
- 50: }</span>
155
- 51: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">c_name</span>.<span class="ruby-identifier">constantize</span>
156
- 52: <span class="ruby-keyword kw">end</span>
157
- 53:
158
- 54: <span class="ruby-keyword kw">end</span>
145
+ <span class="ruby-comment cmt"># File lib/cachetastic/cacheable.rb, line 41</span>
146
+ 41: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cache_class</span>
147
+ 42: <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>
148
+ 43: <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">&quot;Class&quot;</span>
149
+ 44: <span class="ruby-identifier">c_name</span> = <span class="ruby-node">&quot;Cachetastic::Cacheable::#{n.gsub('::', '_')}Cache&quot;</span>
150
+ 45: <span class="ruby-keyword kw">begin</span>
151
+ 46: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">c_name</span>.<span class="ruby-identifier">constantize</span>
152
+ 47: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">NameError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
153
+ 48: <span class="ruby-identifier">eval</span> <span class="ruby-node">%{
154
+ 49: class #{c_name} &lt; Cachetastic::Cache
155
+ 50:
156
+ 51: def self.cache_klass
157
+ 52: #{n}
158
+ 53: end
159
+ 54:
160
+ 55: end
161
+ 56: }</span>
162
+ 57: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">c_name</span>.<span class="ruby-identifier">constantize</span>
163
+ 58: <span class="ruby-keyword kw">end</span>
164
+ 59:
165
+ 60: <span class="ruby-keyword kw">end</span>
159
166
  </pre>
160
167
  </div>
161
168
  </div>
162
169
  </div>
163
170
 
164
- <div id="method-M000072" class="method-detail">
165
- <a name="M000072"></a>
171
+ <div id="method-M000016" class="method-detail">
172
+ <a name="M000016"></a>
166
173
 
167
174
  <div class="method-heading">
168
- <a href="#M000072" class="method-signature">
169
- <span class="method-name">cacher</span><span class="method-args">(key, expiry = 0) {|| ...}</span>
175
+ <a href="#M000016" class="method-signature">
176
+ <span class="method-name">cacher</span><span class="method-args">(key, expiry = nil) {|| ...}</span>
170
177
  </a>
171
178
  </div>
172
179
 
@@ -184,10 +191,7 @@ Example:
184
191
  <pre>
185
192
  class Person
186
193
  include Cachetastic::Cacheable
187
- attr_accessor :name
188
- def cachetastic_key
189
- self.name
190
- end
194
+
191
195
  def always_the_same(x,y)
192
196
  cacher(&quot;always_the_same&quot;) do
193
197
  x + y
@@ -207,28 +211,28 @@ Example:
207
211
  Cachetastic::Cacheable::PersonCache.get(&quot;say_hi&quot;) # =&gt; &quot;Hi There&quot;
208
212
  </pre>
209
213
  <p><a class="source-toggle" href="#"
210
- onclick="toggleCode('M000072-source');return false;">[Source]</a></p>
211
- <div class="method-source-code" id="M000072-source">
214
+ onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
215
+ <div class="method-source-code" id="M000016-source">
212
216
  <pre>
213
- <span class="ruby-comment cmt"># File lib/cachetastic/cacheable.rb, line 86</span>
214
- 86: <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>)
215
- 87: <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>
216
- 88: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
217
- 89: <span class="ruby-identifier">res</span> = <span class="ruby-keyword kw">yield</span>
218
- 90: <span class="ruby-identifier">cache_class</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">res</span>, <span class="ruby-identifier">expiry</span>)
219
- 91: <span class="ruby-keyword kw">end</span>
220
- 92: <span class="ruby-keyword kw">end</span>
221
- 93: <span class="ruby-keyword kw">end</span>
217
+ <span class="ruby-comment cmt"># File lib/cachetastic/cacheable.rb, line 89</span>
218
+ 89: <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-keyword kw">nil</span>)
219
+ 90: <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>
220
+ 91: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
221
+ 92: <span class="ruby-identifier">res</span> = <span class="ruby-keyword kw">yield</span>
222
+ 93: <span class="ruby-identifier">cache_class</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">res</span>, <span class="ruby-identifier">expiry</span>)
223
+ 94: <span class="ruby-keyword kw">end</span>
224
+ 95: <span class="ruby-keyword kw">end</span>
225
+ 96: <span class="ruby-keyword kw">end</span>
222
226
  </pre>
223
227
  </div>
224
228
  </div>
225
229
  </div>
226
230
 
227
- <div id="method-M000073" class="method-detail">
228
- <a name="M000073"></a>
231
+ <div id="method-M000017" class="method-detail">
232
+ <a name="M000017"></a>
229
233
 
230
234
  <div class="method-heading">
231
- <a href="#M000073" class="method-signature">
235
+ <a href="#M000017" class="method-signature">
232
236
  <span class="method-name">expire_all</span><span class="method-args">()</span>
233
237
  </a>
234
238
  </div>
@@ -259,13 +263,13 @@ Example:
259
263
  Person.get_from_cache(1) # =&gt; nil
260
264
  </pre>
261
265
  <p><a class="source-toggle" href="#"
262
- onclick="toggleCode('M000073-source');return false;">[Source]</a></p>
263
- <div class="method-source-code" id="M000073-source">
266
+ onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
267
+ <div class="method-source-code" id="M000017-source">
264
268
  <pre>
265
- <span class="ruby-comment cmt"># File lib/cachetastic/cacheable.rb, line 114</span>
266
- 114: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">expire_all</span>
267
- 115: <span class="ruby-identifier">cache_class</span>.<span class="ruby-identifier">expire_all</span>
268
- 116: <span class="ruby-keyword kw">end</span>
269
+ <span class="ruby-comment cmt"># File lib/cachetastic/cacheable.rb, line 117</span>
270
+ 117: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">expire_all</span>
271
+ 118: <span class="ruby-identifier">cache_class</span>.<span class="ruby-identifier">expire_all</span>
272
+ 119: <span class="ruby-keyword kw">end</span>
269
273
  </pre>
270
274
  </div>
271
275
  </div>
@@ -80,9 +80,9 @@
80
80
  <h3 class="section-bar">Methods</h3>
81
81
 
82
82
  <div class="name-list">
83
- <a href="#M000069">delete_from_cache</a>&nbsp;&nbsp;
84
- <a href="#M000068">get_from_cache</a>&nbsp;&nbsp;
85
- <a href="#M000070">set_into_cache</a>&nbsp;&nbsp;
83
+ <a href="#M000013">delete_from_cache</a>&nbsp;&nbsp;
84
+ <a href="#M000012">get_from_cache</a>&nbsp;&nbsp;
85
+ <a href="#M000014">set_into_cache</a>&nbsp;&nbsp;
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-M000069" class="method-detail">
108
- <a name="M000069"></a>
107
+ <div id="method-M000013" class="method-detail">
108
+ <a name="M000013"></a>
109
109
 
110
110
  <div class="method-heading">
111
- <a href="#M000069" class="method-signature">
111
+ <a href="#M000013" 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,23 +118,23 @@
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('M000069-source');return false;">[Source]</a></p>
122
- <div class="method-source-code" id="M000069-source">
121
+ onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
122
+ <div class="method-source-code" id="M000013-source">
123
123
  <pre>
124
- <span class="ruby-comment cmt"># File lib/cachetastic/cacheable.rb, line 187</span>
125
- 187: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete_from_cache</span>(<span class="ruby-identifier">key</span>)
126
- 188: <span class="ruby-identifier">cache_class</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>)
127
- 189: <span class="ruby-keyword kw">end</span>
124
+ <span class="ruby-comment cmt"># File lib/cachetastic/cacheable.rb, line 191</span>
125
+ 191: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete_from_cache</span>(<span class="ruby-identifier">key</span>)
126
+ 192: <span class="ruby-identifier">cache_class</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>)
127
+ 193: <span class="ruby-keyword kw">end</span>
128
128
  </pre>
129
129
  </div>
130
130
  </div>
131
131
  </div>
132
132
 
133
- <div id="method-M000068" class="method-detail">
134
- <a name="M000068"></a>
133
+ <div id="method-M000012" class="method-detail">
134
+ <a name="M000012"></a>
135
135
 
136
136
  <div class="method-heading">
137
- <a href="#M000068" class="method-signature">
137
+ <a href="#M000012" class="method-signature">
138
138
  <span class="method-name">get_from_cache</span><span class="method-args">(key, &amp;block)</span>
139
139
  </a>
140
140
  </div>
@@ -144,23 +144,23 @@ 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('M000068-source');return false;">[Source]</a></p>
148
- <div class="method-source-code" id="M000068-source">
147
+ onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
148
+ <div class="method-source-code" id="M000012-source">
149
149
  <pre>
150
- <span class="ruby-comment cmt"># File lib/cachetastic/cacheable.rb, line 182</span>
151
- 182: <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">&amp;</span><span class="ruby-identifier">block</span>)
152
- 183: <span class="ruby-identifier">cache_class</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">key</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
153
- 184: <span class="ruby-keyword kw">end</span>
150
+ <span class="ruby-comment cmt"># File lib/cachetastic/cacheable.rb, line 186</span>
151
+ 186: <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">&amp;</span><span class="ruby-identifier">block</span>)
152
+ 187: <span class="ruby-identifier">cache_class</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">key</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
153
+ 188: <span class="ruby-keyword kw">end</span>
154
154
  </pre>
155
155
  </div>
156
156
  </div>
157
157
  </div>
158
158
 
159
- <div id="method-M000070" class="method-detail">
160
- <a name="M000070"></a>
159
+ <div id="method-M000014" class="method-detail">
160
+ <a name="M000014"></a>
161
161
 
162
162
  <div class="method-heading">
163
- <a href="#M000070" class="method-signature">
163
+ <a href="#M000014" 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,13 +170,13 @@ 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('M000070-source');return false;">[Source]</a></p>
174
- <div class="method-source-code" id="M000070-source">
173
+ onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
174
+ <div class="method-source-code" id="M000014-source">
175
175
  <pre>
176
- <span class="ruby-comment cmt"># File lib/cachetastic/cacheable.rb, line 192</span>
177
- 192: <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
- 193: <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
- 194: <span class="ruby-keyword kw">end</span>
176
+ <span class="ruby-comment cmt"># File lib/cachetastic/cacheable.rb, line 196</span>
177
+ 196: <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
+ 197: <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
+ 198: <span class="ruby-keyword kw">end</span>
180
180
  </pre>
181
181
  </div>
182
182
  </div>
@@ -65,9 +65,7 @@
65
65
  <tr class="top-aligned-row">
66
66
  <td><strong>Parent:</strong></td>
67
67
  <td>
68
- <a href="../Object.html">
69
68
  Object
70
- </a>
71
69
  </td>
72
70
  </tr>
73
71
  </table>
@@ -82,8 +80,22 @@
82
80
 
83
81
  <div id="description">
84
82
  <p>
85
- This class handles logging for the caches and their adapters.
83
+ This class handles logging for the caches and their adapters. This class
84
+ exists simply to supply the ability to write to multiple loggers
85
+ simultaneously from a single call. It also creates a standardized message
86
+ to write to those loggers.
86
87
  </p>
88
+ <p>
89
+ It is important that any logger type of class you decide to use reponds to
90
+ the following methods:
91
+ </p>
92
+ <pre>
93
+ fatal(message)
94
+ error(message)
95
+ warn(message)
96
+ info(message)
97
+ debug(message)
98
+ </pre>
87
99
 
88
100
  </div>
89
101
 
@@ -94,7 +106,7 @@ This class handles logging for the caches and their adapters.
94
106
  <h3 class="section-bar">Methods</h3>
95
107
 
96
108
  <div class="name-list">
97
- <a href="#M000074">new</a>&nbsp;&nbsp;
109
+ <a href="#M000026">new</a>&nbsp;&nbsp;
98
110
  </div>
99
111
  </div>
100
112
 
@@ -106,19 +118,6 @@ This class handles logging for the caches and their adapters.
106
118
  <div id="section">
107
119
 
108
120
 
109
- <div id="constants-list">
110
- <h3 class="section-bar">Constants</h3>
111
-
112
- <div class="name-list">
113
- <table summary="Constants">
114
- <tr class="top-aligned-row context-row">
115
- <td class="context-item-name">LOG_LEVELS</td>
116
- <td>=</td>
117
- <td class="context-item-value">[:fatal, :error, :warn, :info, :debug]</td>
118
- </tr>
119
- </table>
120
- </div>
121
- </div>
122
121
 
123
122
 
124
123
 
@@ -131,7 +130,7 @@ This class handles logging for the caches and their adapters.
131
130
  <td class="context-item-name">loggers</td>
132
131
  <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
133
132
  <td class="context-item-desc">
134
- attr_accessor :options attr_accessor :cache_name
133
+ An <tt>Array</tt> of &#8216;real&#8217; loggers to write to.
135
134
 
136
135
  </td>
137
136
  </tr>
@@ -145,29 +144,28 @@ attr_accessor :options attr_accessor :cache_name
145
144
  <div id="methods">
146
145
  <h3 class="section-bar">Public Class methods</h3>
147
146
 
148
- <div id="method-M000074" class="method-detail">
149
- <a name="M000074"></a>
147
+ <div id="method-M000026" class="method-detail">
148
+ <a name="M000026"></a>
150
149
 
151
150
  <div class="method-heading">
152
- <a href="#M000074" class="method-signature">
153
- <span class="method-name">new</span><span class="method-args">(loggers)</span>
151
+ <a href="#M000026" class="method-signature">
152
+ <span class="method-name">new</span><span class="method-args">(*loggers)</span>
154
153
  </a>
155
154
  </div>
156
155
 
157
156
  <div class="method-description">
157
+ <p>
158
+ The <tt>initialize</tt> method takes an <tt>Array</tt> of your favorite
159
+ logger style classes to write to.
160
+ </p>
158
161
  <p><a class="source-toggle" href="#"
159
- onclick="toggleCode('M000074-source');return false;">[Source]</a></p>
160
- <div class="method-source-code" id="M000074-source">
162
+ onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
163
+ <div class="method-source-code" id="M000026-source">
161
164
  <pre>
162
- <span class="ruby-comment cmt"># File lib/cachetastic/logger.rb, line 8</span>
163
- 8: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">loggers</span>)
164
- 9: <span class="ruby-ivar">@loggers</span> = [<span class="ruby-identifier">loggers</span>].<span class="ruby-identifier">flatten</span>
165
- 10: <span class="ruby-comment cmt"># self.options = options</span>
166
- 11: <span class="ruby-comment cmt"># self.cache_name = cache_name</span>
167
- 12: <span class="ruby-comment cmt"># self.options.each_pair do |n, opts|</span>
168
- 13: <span class="ruby-comment cmt"># opts[&quot;level&quot;] = (opts[&quot;level&quot;] ||= &quot;info&quot;).to_sym</span>
169
- 14: <span class="ruby-comment cmt"># end</span>
170
- 15: <span class="ruby-keyword kw">end</span>
165
+ <span class="ruby-comment cmt"># File lib/cachetastic/logger.rb, line 21</span>
166
+ 21: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">loggers</span>)
167
+ 22: <span class="ruby-ivar">@loggers</span> = [<span class="ruby-identifier">loggers</span>].<span class="ruby-identifier">flatten</span>
168
+ 23: <span class="ruby-keyword kw">end</span>
171
169
  </pre>
172
170
  </div>
173
171
  </div>
data/doc/created.rid CHANGED
@@ -1 +1 @@
1
- Fri, 27 Feb 2009 14:06:40 -0500
1
+ Thu, 11 Jun 2009 14:19:33 -0400
@@ -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>File: html_file.rb</title>
8
+ <title>File: LICENSE</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="../../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
12
  <script type="text/javascript">
13
13
  // <![CDATA[
14
14
 
@@ -47,16 +47,16 @@
47
47
 
48
48
 
49
49
  <div id="fileHeader">
50
- <h1>html_file.rb</h1>
50
+ <h1>LICENSE</h1>
51
51
  <table class="header-table">
52
52
  <tr class="top-aligned-row">
53
53
  <td><strong>Path:</strong></td>
54
- <td>lib/cachetastic/adapters/html_file.rb
54
+ <td>LICENSE
55
55
  </td>
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Thu Jan 01 11:33:36 -0500 2009</td>
59
+ <td>Fri Jun 05 17:12:05 -0400 2009</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -70,41 +70,36 @@
70
70
 
71
71
  <div id="description">
72
72
  <p>
73
- This adapter uses the file system as it&#8216;s backing. Caches are stored
74
- in files called index.html. At the beginning of the html the following html
75
- comments are pre-pended:
73
+ The MIT License
76
74
  </p>
77
- <pre>
78
- &lt;!-- cachetastic: expires_at: Fri Feb 01 20:51:45 -0500 2008 --&gt;
79
- &lt;!-- cachetastic: key: /channels/1-arts-humanities --&gt;
80
- </pre>
81
75
  <p>
82
- Obviously the expires_at date will be the ACTUAL expire date, same goes for
83
- the key. The configuration for this should look something like this:
76
+ Copyright (c) 2009 Mark Bates
77
+ </p>
78
+ <p>
79
+ Permission is hereby granted, free of charge, to any person obtaining a
80
+ copy of this software and associated documentation files (the
81
+ &quot;Software&quot;), to deal in the Software without restriction,
82
+ including without limitation the rights to use, copy, modify, merge,
83
+ publish, distribute, sublicense, and/or sell copies of the Software, and to
84
+ permit persons to whom the Software is furnished to do so, subject to the
85
+ following conditions:
86
+ </p>
87
+ <p>
88
+ The above copyright notice and this permission notice shall be included in
89
+ all copies or substantial portions of the Software.
90
+ </p>
91
+ <p>
92
+ THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
93
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
94
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
95
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
96
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
97
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
98
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
84
99
  </p>
85
- <pre>
86
- my_awesome_cache_options:
87
- debug: false
88
- adapter: html_file
89
- marshall_method: none
90
- default_expiry: &lt;%= 24.hours %&gt;
91
- store_options:
92
- dir: /usr/local/caches/
93
- logging:
94
- logger_1:
95
- type: file
96
- file: log/file_store_cache.log
97
- </pre>
98
100
 
99
101
  </div>
100
102
 
101
- <div id="requires-list">
102
- <h3 class="section-bar">Required files</h3>
103
-
104
- <div class="name-list">
105
- time&nbsp;&nbsp;
106
- </div>
107
- </div>
108
103
 
109
104
  </div>
110
105