doc/classes/Cachetastic/Caches/Base.html in cachetastic-2.1.3 vs doc/classes/Cachetastic/Caches/Base.html in cachetastic-2.1.4
- old
+ new
@@ -118,24 +118,24 @@
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
- <a href="#M000055">adapter</a>
- <a href="#M000058">adapter_supported?</a>
- <a href="#M000048">all_registered_caches</a>
- <a href="#M000054">cache_name</a>
- <a href="#M000061">calculate_expiry_time</a>
- <a href="#M000051">delete</a>
- <a href="#M000052">expire_all</a>
- <a href="#M000049">get</a>
- <a href="#M000056">logger</a>
- <a href="#M000059">marshall</a>
- <a href="#M000050">set</a>
- <a href="#M000053">stats</a>
- <a href="#M000060">unmarshall</a>
- <a href="#M000057">unsupported_adapters</a>
+ <a href="#M000058">adapter</a>
+ <a href="#M000061">adapter_supported?</a>
+ <a href="#M000051">all_registered_caches</a>
+ <a href="#M000057">cache_name</a>
+ <a href="#M000064">calculate_expiry_time</a>
+ <a href="#M000054">delete</a>
+ <a href="#M000055">expire_all</a>
+ <a href="#M000052">get</a>
+ <a href="#M000059">logger</a>
+ <a href="#M000062">marshall</a>
+ <a href="#M000053">set</a>
+ <a href="#M000056">stats</a>
+ <a href="#M000063">unmarshall</a>
+ <a href="#M000060">unsupported_adapters</a>
</div>
</div>
</div>
@@ -172,15 +172,15 @@
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
- <div id="method-M000055" class="method-detail">
- <a name="M000055"></a>
+ <div id="method-M000058" class="method-detail">
+ <a name="M000058"></a>
<div class="method-heading">
- <a href="#M000055" class="method-signature">
+ <a href="#M000058" class="method-signature">
<span class="method-name">adapter</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
@@ -188,12 +188,12 @@
Returns the underlying <a
href="../Adapters/Base.html">Cachetastic::Adapters::Base</a> for this
cache.
</p>
<p><a class="source-toggle" href="#"
- onclick="toggleCode('M000055-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000055-source">
+ onclick="toggleCode('M000058-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000058-source">
<pre>
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 139</span>
139: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">adapter</span>
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>)
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>)
@@ -205,68 +205,68 @@
</pre>
</div>
</div>
</div>
- <div id="method-M000058" class="method-detail">
- <a name="M000058"></a>
+ <div id="method-M000061" class="method-detail">
+ <a name="M000061"></a>
<div class="method-heading">
- <a href="#M000058" class="method-signature">
+ <a href="#M000061" class="method-signature">
<span class="method-name">adapter_supported?</span><span class="method-args">(a = cache_conn_instance.get(cache_name).class)</span>
</a>
</div>
<div class="method-description">
<p>
-Returns true/false on whether the <a href="Base.html#M000055">adapter</a>
+Returns true/false on whether the <a href="Base.html#M000058">adapter</a>
you want to use is supported for the cache.
</p>
<p><a class="source-toggle" href="#"
- onclick="toggleCode('M000058-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000058-source">
+ onclick="toggleCode('M000061-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000061-source">
<pre>
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 161</span>
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>)
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>)
163: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
- <div id="method-M000048" class="method-detail">
- <a name="M000048"></a>
+ <div id="method-M000051" class="method-detail">
+ <a name="M000051"></a>
<div class="method-heading">
- <a href="#M000048" class="method-signature">
+ <a href="#M000051" class="method-signature">
<span class="method-name">all_registered_caches</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p>
Returns a list of all registered caches in the system.
</p>
<p><a class="source-toggle" href="#"
- onclick="toggleCode('M000048-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000048-source">
+ onclick="toggleCode('M000051-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000051-source">
<pre>
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 48</span>
48: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">all_registered_caches</span>
49: <span class="ruby-constant">RegisteredCaches</span>.<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">list</span>
50: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
- <div id="method-M000054" class="method-detail">
- <a name="M000054"></a>
+ <div id="method-M000057" class="method-detail">
+ <a name="M000057"></a>
<div class="method-heading">
- <a href="#M000054" class="method-signature">
+ <a href="#M000057" class="method-signature">
<span class="method-name">cache_name</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
@@ -278,41 +278,41 @@
<pre>
MyAwesomeCache.cache # => "my_awesome_cache"
Cachetastic::Caches::Base # => "cachetastic_caches_base"
</pre>
<p><a class="source-toggle" href="#"
- onclick="toggleCode('M000054-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000054-source">
+ onclick="toggleCode('M000057-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000057-source">
<pre>
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 134</span>
134: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cache_name</span>
135: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">methodize</span>
136: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
- <div id="method-M000051" class="method-detail">
- <a name="M000051"></a>
+ <div id="method-M000054" class="method-detail">
+ <a name="M000054"></a>
<div class="method-heading">
- <a href="#M000051" class="method-signature">
+ <a href="#M000054" class="method-signature">
<span class="method-name">delete</span><span class="method-args">(key, delay = 0)</span>
</a>
</div>
<div class="method-description">
<p>
Deletes an object from the cache. The optional delay parameter sets an
offset, in seconds, for when the object should <a
-href="Base.html#M000049">get</a> deleted. The default of 0 means the object
+href="Base.html#M000052">get</a> deleted. The default of 0 means the object
gets deleted right away.
</p>
<p><a class="source-toggle" href="#"
- onclick="toggleCode('M000051-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000051-source">
+ onclick="toggleCode('M000054-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000054-source">
<pre>
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 108</span>
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>)
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>
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>)
@@ -321,26 +321,26 @@
</pre>
</div>
</div>
</div>
- <div id="method-M000052" class="method-detail">
- <a name="M000052"></a>
+ <div id="method-M000055" class="method-detail">
+ <a name="M000055"></a>
<div class="method-heading">
- <a href="#M000052" class="method-signature">
+ <a href="#M000055" class="method-signature">
<span class="method-name">expire_all</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p>
Expires all objects for this cache.
</p>
<p><a class="source-toggle" href="#"
- onclick="toggleCode('M000052-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000052-source">
+ onclick="toggleCode('M000055-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000055-source">
<pre>
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 115</span>
115: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">expire_all</span>
116: <span class="ruby-identifier">adapter</span>.<span class="ruby-identifier">expire_all</span>
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>)
@@ -348,30 +348,30 @@
</pre>
</div>
</div>
</div>
- <div id="method-M000049" class="method-detail">
- <a name="M000049"></a>
+ <div id="method-M000052" class="method-detail">
+ <a name="M000052"></a>
<div class="method-heading">
- <a href="#M000049" class="method-signature">
+ <a href="#M000052" class="method-signature">
<span class="method-name">get</span><span class="method-args">(key) {|key if block_given?| ...}</span>
</a>
</div>
<div class="method-description">
<p>
Returns an object from the cache for a given key. If the object comes back
as nil and a block is given that block will be run and the results of the
block will be run. This can be used to JIT caches, just make sure in the
-block to call the <a href="Base.html#M000050">set</a> method because the
+block to call the <a href="Base.html#M000053">set</a> method because the
results of the block are not automatically cached.
</p>
<p><a class="source-toggle" href="#"
- onclick="toggleCode('M000049-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000049-source">
+ onclick="toggleCode('M000052-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000052-source">
<pre>
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 58</span>
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>)
59: <span class="ruby-identifier">res</span> = <span class="ruby-keyword kw">nil</span>
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>
@@ -403,50 +403,50 @@
</pre>
</div>
</div>
</div>
- <div id="method-M000056" class="method-detail">
- <a name="M000056"></a>
+ <div id="method-M000059" class="method-detail">
+ <a name="M000059"></a>
<div class="method-heading">
- <a href="#M000056" class="method-signature">
+ <a href="#M000059" class="method-signature">
<span class="method-name">logger</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p>
Returns the <a href="../Logger.html">Cachetastic::Logger</a> for the
underlying <a href="../Adapters/Base.html">Cachetastic::Adapters::Base</a>.
</p>
<p><a class="source-toggle" href="#"
- onclick="toggleCode('M000056-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000056-source">
+ onclick="toggleCode('M000059-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000059-source">
<pre>
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 149</span>
149: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">logger</span>
150: <span class="ruby-identifier">adapter</span>.<span class="ruby-identifier">logger</span>
151: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
- <div id="method-M000059" class="method-detail">
- <a name="M000059"></a>
+ <div id="method-M000062" class="method-detail">
+ <a name="M000062"></a>
<div class="method-heading">
- <a href="#M000059" class="method-signature">
+ <a href="#M000062" class="method-signature">
<span class="method-name">marshall</span><span class="method-args">(value)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
- onclick="toggleCode('M000059-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000059-source">
+ onclick="toggleCode('M000062-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000062-source">
<pre>
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 165</span>
165: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">marshall</span>(<span class="ruby-identifier">value</span>)
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>
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>
@@ -461,33 +461,33 @@
</pre>
</div>
</div>
</div>
- <div id="method-M000050" class="method-detail">
- <a name="M000050"></a>
+ <div id="method-M000053" class="method-detail">
+ <a name="M000053"></a>
<div class="method-heading">
- <a href="#M000050" class="method-signature">
+ <a href="#M000053" class="method-signature">
<span class="method-name">set</span><span class="method-args">(key, value, expiry = adapter.configuration.retrieve(:default_expiry, 0))</span>
</a>
</div>
<div class="method-description">
<p>
Set a particular object info the cache for the given key. An optional third
parameter sets the expiry time for the object in the cache. The default for
-this expiry is <a href="Base.html#M000050">set</a> as either 0, meaning it
+this expiry is <a href="Base.html#M000053">set</a> as either 0, meaning it
never expires, or if there‘s a default_expiry time <a
-href="Base.html#M000050">set</a> in the config file, that file will be
-used. If there is an expiry_swing <a href="Base.html#M000050">set</a> in
+href="Base.html#M000053">set</a> in the config file, that file will be
+used. If there is an expiry_swing <a href="Base.html#M000053">set</a> in
the config file it will be +/- to the expiry time. See also: <a
-href="Base.html#M000061">calculate_expiry_time</a>
+href="Base.html#M000064">calculate_expiry_time</a>
</p>
<p><a class="source-toggle" href="#"
- onclick="toggleCode('M000050-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000050-source">
+ onclick="toggleCode('M000053-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000053-source">
<pre>
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 94</span>
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>))
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>
96: <span class="ruby-identifier">expiry</span> = <span class="ruby-identifier">calculate_expiry_time</span>(<span class="ruby-identifier">expiry</span>)
@@ -499,50 +499,50 @@
</pre>
</div>
</div>
</div>
- <div id="method-M000053" class="method-detail">
- <a name="M000053"></a>
+ <div id="method-M000056" class="method-detail">
+ <a name="M000056"></a>
<div class="method-heading">
- <a href="#M000053" class="method-signature">
+ <a href="#M000056" class="method-signature">
<span class="method-name">stats</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p>
A convenience method that returns statistics for the underlying <a
href="../Adapters/Base.html">Cachetastic::Adapters::Base</a> for the cache.
</p>
<p><a class="source-toggle" href="#"
- onclick="toggleCode('M000053-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000053-source">
+ onclick="toggleCode('M000056-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000056-source">
<pre>
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 126</span>
126: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stats</span>
127: <span class="ruby-identifier">adapter</span>.<span class="ruby-identifier">stats</span>
128: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
- <div id="method-M000060" class="method-detail">
- <a name="M000060"></a>
+ <div id="method-M000063" class="method-detail">
+ <a name="M000063"></a>
<div class="method-heading">
- <a href="#M000060" class="method-signature">
+ <a href="#M000063" class="method-signature">
<span class="method-name">unmarshall</span><span class="method-args">(value)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
- onclick="toggleCode('M000060-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000060-source">
+ onclick="toggleCode('M000063-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000063-source">
<pre>
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 177</span>
177: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unmarshall</span>(<span class="ruby-identifier">value</span>)
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>
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>
@@ -557,29 +557,29 @@
</pre>
</div>
</div>
</div>
- <div id="method-M000057" class="method-detail">
- <a name="M000057"></a>
+ <div id="method-M000060" class="method-detail">
+ <a name="M000060"></a>
<div class="method-heading">
- <a href="#M000057" class="method-signature">
+ <a href="#M000060" class="method-signature">
<span class="method-name">unsupported_adapters</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p>
Returns an array of unsupported adapters for this cache. Defaults to an
-empty array which will let any <a href="Base.html#M000055">adapter</a> be
+empty array which will let any <a href="Base.html#M000058">adapter</a> be
used by the cache. Override in your specific cache to prevent certain
adapters.
</p>
<p><a class="source-toggle" href="#"
- onclick="toggleCode('M000057-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000057-source">
+ onclick="toggleCode('M000060-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000060-source">
<pre>
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 156</span>
156: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unsupported_adapters</span>
157: []
158: <span class="ruby-keyword kw">end</span>
@@ -588,27 +588,27 @@
</div>
</div>
<h3 class="section-bar">Private Class methods</h3>
- <div id="method-M000061" class="method-detail">
- <a name="M000061"></a>
+ <div id="method-M000064" class="method-detail">
+ <a name="M000064"></a>
<div class="method-heading">
- <a href="#M000061" class="method-signature">
+ <a href="#M000064" class="method-signature">
<span class="method-name">calculate_expiry_time</span><span class="method-args">(expiry)</span>
</a>
</div>
<div class="method-description">
<p>
-If the expiry time is <a href="Base.html#M000050">set</a> to 60 minutes and
-the expiry_swing time is <a href="Base.html#M000050">set</a> to 15 minutes,
+If the expiry time is <a href="Base.html#M000053">set</a> to 60 minutes and
+the expiry_swing time is <a href="Base.html#M000053">set</a> to 15 minutes,
this method will return a number between 45 minutes and 75 minutes.
</p>
<p><a class="source-toggle" href="#"
- onclick="toggleCode('M000061-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000061-source">
+ onclick="toggleCode('M000064-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000064-source">
<pre>
<span class="ruby-comment cmt"># File lib/cachetastic/caches/base.rb, line 192</span>
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>
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>)
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>
\ No newline at end of file