doc/index.html
<!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=US-ASCII" />
<title>
File: README
— 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</a> »
<span class="title">File: README</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"><div id='filecontents'><h1 id="elephas">elephas</h1>
<p><a href="http://badge.fury.io/rb/elephas"><img src="https://badge.fury.io/rb/elephas.png" alt="Gem Version" /></a>
<a href="https://gemnasium.com/ShogunPanda/elephas"><img src="https://gemnasium.com/ShogunPanda/elephas.png?travis" alt="Dependency Status" /></a>
<a href="http://travis-ci.org/ShogunPanda/elephas"><img src="https://secure.travis-ci.org/ShogunPanda/elephas.png?branch=master" alt="Build Status" /></a>
<a href="https://codeclimate.com/github/ShogunPanda/elephas"><img src="https://codeclimate.com/github/ShogunPanda/elephas.png" alt="Code Climate" /></a>
<a href="https://coveralls.io/r/ShogunPanda/elephas"><img src="https://coveralls.io/repos/ShogunPanda/elephas/badge.png" alt="Coverage Status" /></a></p>
<p>A storage agnostic caching framework.</p>
<p>http://sw.cow.tc/elephas</p>
<p>http://rdoc.info/gems/elephas</p>
<h2 id="usage">Usage</h2>
<p>The usage of the framework is really simple.</p>
<p>At first you have to setup a cache object with a backend (that is, a storage) for the Elephas. By default it uses an internal hash, and also Rails is supported.</p>
<p><code>ruby
cache = Elephas::Cache.new(Elephas::Backends::RubyOnRails.new)
</code></p>
<p>After that, you can query the framework for a value use the <code>use</code> method.</p>
<p>You should also pass a block to the method, so that the framework use that for computing the value of the cache entry.</p>
<p><code>ruby
value = cache.use("KEY") do |options|
"VALUE"
end
# => "VALUE"
</code></p>
<p>The next time you issue this call, the block won’t be called.</p>
<p>The block takes an argument, which contains all the options for the entry.</p>
<p>You can see <code>Elephas::Cache#setup_options</code> documentation to see what options are supported.</p>
<p>For now, you just have to know that you can set the <code>:ttl</code> option to specify how long the value will stay in the cache (in milliseconds). Setting it to a non-positive value means to never cache the value.</p>
<p>See documentation for more informations.</p>
<p><strong>You’re done!</strong></p>
<h2 id="contributing-to-elephas">Contributing to elephas</h2>
<ul>
<li>Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.</li>
<li>Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it.</li>
<li>Fork the project.</li>
<li>Start a feature/bugfix branch.</li>
<li>Commit and push until you are happy with your contribution.</li>
<li>Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.</li>
<li>Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.</li>
</ul>
<h2 id="copyright">Copyright</h2>
<p>Copyright (C) 2013 and above Shogun (shogun@cowtech.it).</p>
<p>Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.</p>
</div></div>
<div id="footer">
Generated on Sat Jul 20 13:31:55 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>