<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> Class: Elephas::Backends::Base — Documentation by YARD 0.8.6.2 </title> <link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" /> <link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" /> <script type="text/javascript" charset="utf-8"> hasFrames = window.top.frames.main ? true : false; relpath = '../../'; framesUrl = "../../frames.html#!" + escape(window.location.href); </script> <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script> <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script> </head> <body> <div id="header"> <div id="menu"> <a href="../../_index.html">Index (B)</a> » <span class='title'><span class='object_link'><a href="../../Elephas.html" title="Elephas (module)">Elephas</a></span></span> » <span class='title'><span class='object_link'><a href="../Backends.html" title="Elephas::Backends (module)">Backends</a></span></span> » <span class="title">Base</span> <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div> </div> <div id="search"> <a class="full_list_link" id="class_list_link" href="../../class_list.html"> Class List </a> <a class="full_list_link" id="method_list_link" href="../../method_list.html"> Method List </a> <a class="full_list_link" id="file_list_link" href="../../file_list.html"> File List </a> </div> <div class="clear"></div> </div> <iframe id="search_frame"></iframe> <div id="content"><h1>Class: Elephas::Backends::Base </h1> <dl class="box"> <dt class="r1">Inherits:</dt> <dd class="r1"> <span class="inheritName">Object</span> <ul class="fullTree"> <li>Object</li> <li class="next">Elephas::Backends::Base</li> </ul> <a href="#" class="inheritanceTree">show all</a> </dd> <dt class="r2">Includes:</dt> <dd class="r2">Lazier::I18n</dd> <dt class="r1 last">Defined in:</dt> <dd class="r1 last">lib/elephas/backends/base.rb</dd> </dl> <div class="clear"></div> <h2>Overview</h2><div class="docstring"> <div class="discussion"> <p>The a base backend. All data-related methods must be overriden.</p> </div> </div> <div class="tags"> </div><div id="subclasses"> <h2>Direct Known Subclasses</h2> <p class="children"><span class='object_link'><a href="Hash.html" title="Elephas::Backends::Hash (class)">Hash</a></span>, <span class='object_link'><a href="RubyOnRails.html" title="Elephas::Backends::RubyOnRails (class)">RubyOnRails</a></span></p> </div> <h2> Instance Method Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small> </h2> <ul class="summary"> <li class="public "> <span class="summary_signature"> <a href="#delete-instance_method" title="#delete (instance method)">- (TrueClass|FalseClass) <strong>delete</strong>(key) </a> </span> <span class="summary_desc"><div class='inline'><p>Deletes a value from the cache.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#exists%3F-instance_method" title="#exists? (instance method)">- (TrueClass|FalseClass) <strong>exists?</strong>(key) </a> </span> <span class="summary_desc"><div class='inline'><p>Checks if a key exists in the cache.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#now-instance_method" title="#now (instance method)">- (Object) <strong>now</strong> </a> </span> <span class="summary_desc"><div class='inline'><p>Returns the current time for comparing with entries TTL.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#read-instance_method" title="#read (instance method)">- (Entry|NilClass) <strong>read</strong>(key) </a> </span> <span class="summary_desc"><div class='inline'><p>Reads a value from the cache.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#write-instance_method" title="#write (instance method)">- (Object) <strong>write</strong>(key, value, options = {}) </a> </span> <span class="summary_desc"><div class='inline'><p>Writes a value to the cache.</p> </div></span> </li> </ul> <div id="instance_method_details" class="method_details_list"> <h2>Instance Method Details</h2> <div class="method_details first"> <h3 class="signature first" id="delete-instance_method"> - (<tt>TrueClass|FalseClass</tt>) <strong>delete</strong>(key) </h3><div class="docstring"> <div class="discussion"> <p>Deletes a value from the cache.</p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>key</span> <span class='type'>(<tt>String</tt>)</span> — <div class='inline'><p>The key to delete.</p> </div> </li> </ul> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt>TrueClass|FalseClass</tt>)</span> — <div class='inline'><p><code>true</code> if the key was in the cache, <code>false</code> otherwise.</p> </div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 37 38 39</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/elephas/backends/base.rb', line 37</span> <span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span> <span class='id identifier rubyid_unimplemented'>unimplemented</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="exists?-instance_method"> - (<tt>TrueClass|FalseClass</tt>) <strong>exists?</strong>(key) </h3><div class="docstring"> <div class="discussion"> <p>Checks if a key exists in the cache.</p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>key</span> <span class='type'>(<tt>String</tt>)</span> — <div class='inline'><p>The key to lookup.</p> </div> </li> </ul> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt>TrueClass|FalseClass</tt>)</span> — <div class='inline'><p><code>true</code> if the key is in the cache, <code>false</code> otherwise.</p> </div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 45 46 47</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/elephas/backends/base.rb', line 45</span> <span class='kw'>def</span> <span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span> <span class='id identifier rubyid_unimplemented'>unimplemented</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="now-instance_method"> - (<tt>Object</tt>) <strong>now</strong> </h3><div class="docstring"> <div class="discussion"> <p>Returns the current time for comparing with entries TTL.</p> </div> </div> <div class="tags"> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt>Object</tt>)</span> — <div class='inline'><p>A representation of the current time.</p> </div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 52 53 54</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/elephas/backends/base.rb', line 52</span> <span class='kw'>def</span> <span class='id identifier rubyid_now'>now</span> <span class='op'>::</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="read-instance_method"> - (<tt><span class='object_link'><a href="../Entry.html" title="Elephas::Entry (class)">Entry</a></span>|NilClass</tt>) <strong>read</strong>(key) </h3><div class="docstring"> <div class="discussion"> <p>Reads a value from the cache.</p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>key</span> <span class='type'>(<tt>String</tt>)</span> — <div class='inline'><p>The key to lookup.</p> </div> </li> </ul> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt><span class='object_link'><a href="../Entry.html" title="Elephas::Entry (class)">Entry</a></span>|NilClass</tt>)</span> — <div class='inline'><p>The read value or <code>nil</code>.</p> </div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 18 19 20</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/elephas/backends/base.rb', line 18</span> <span class='kw'>def</span> <span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span> <span class='id identifier rubyid_unimplemented'>unimplemented</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="write-instance_method"> - (<tt>Object</tt>) <strong>write</strong>(key, value, options = {}) </h3><div class="docstring"> <div class="discussion"> <p>Writes a value to the cache.</p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>key</span> <span class='type'>(<tt>String</tt>)</span> — <div class='inline'><p>The key to associate the value with.</p> </div> </li> <li> <span class='name'>value</span> <span class='type'>(<tt>Object</tt>)</span> — <div class='inline'><p>The value to write. Setting a value to <code>nil</code> <strong>doesn’t</strong> mean <em>deleting</em> the value.</p> </div> </li> <li> <span class='name'>options</span> <span class='type'>(<tt><span class='object_link'><a href="Hash.html" title="Elephas::Backends::Hash (class)">Hash</a></span></tt>)</span> <em class="default">(defaults to: <tt>{}</tt>)</em> — <div class='inline'><p>A list of options for writing.</p> </div> </li> </ul> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt>Object</tt>)</span> — <div class='inline'><p>The value itself.</p> </div> </li> </ul> <p class="tag_title">See Also:</p> <ul class="see"> <li>Cache.setup_options</li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 29 30 31</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/elephas/backends/base.rb', line 29</span> <span class='kw'>def</span> <span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span> <span class='id identifier rubyid_unimplemented'>unimplemented</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> </div> </div> <div id="footer"> Generated on Sun Jul 14 15:54:09 2013 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> 0.8.6.2 (ruby-1.9.3). </div> </body> </html>