Current File : //proc/self/root/kunden/usr/share/gems/doc/memcache-client-1.8.5/rdoc/README_rdoc.html |
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>README - memcache-client-1.8.5 Documentation</title>
<script type="text/javascript">
var rdoc_rel_prefix = "./";
var index_rel_prefix = "./";
</script>
<script src="./js/navigation.js" defer></script>
<script src="./js/search.js" defer></script>
<script src="./js/search_index.js" defer></script>
<script src="./js/searcher.js" defer></script>
<script src="./js/darkfish.js" defer></script>
<link href="./css/fonts.css" rel="stylesheet">
<link href="./css/rdoc.css" rel="stylesheet">
<body id="top" role="document" class="file">
<nav role="navigation">
<div id="project-navigation">
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
<h2>
<a href="./index.html" rel="home">Home</a>
</h2>
<div id="table-of-contents-navigation">
<a href="./table_of_contents.html#pages">Pages</a>
<a href="./table_of_contents.html#classes">Classes</a>
<a href="./table_of_contents.html#methods">Methods</a>
</div>
</div>
<div id="search-section" role="search" class="project-section initially-hidden">
<form action="#" method="get" accept-charset="utf-8">
<div id="search-field-wrapper">
<input id="search-field" role="combobox" aria-label="Search"
aria-autocomplete="list" aria-controls="search-results"
type="text" name="search" placeholder="Search" spellcheck="false"
title="Type to search, Up and Down to navigate, Enter to load">
</div>
<ul id="search-results" aria-label="Search Results"
aria-busy="false" aria-expanded="false"
aria-atomic="false" class="initially-hidden"></ul>
</form>
</div>
</div>
<div class="nav-section">
<h3>Table of Contents</h3>
<ul class="link-list" role="directory">
<li><a href="#label-memcache-client">memcache-client</a>
<li><a href="#label-Installing+memcache-client">Installing memcache-client</a>
<li><a href="#label-Using+memcache-client">Using memcache-client</a>
<li><a href="#label-Tuning+memcache-client">Tuning memcache-client</a>
<li><a href="#label-Using+memcache-client+with+Rails">Using memcache-client with Rails</a>
<li><a href="#label-Using+memcache-client+with+EventMachine">Using memcache-client with EventMachine</a>
<li><a href="#label-Questions-3F">Questions?</a>
</ul>
</div>
<div id="project-metadata">
<div id="fileindex-section" class="nav-section">
<h3>Pages</h3>
<ul class="link-list">
<li><a href="./LICENSE_txt.html">LICENSE</a>
<li><a href="./README_rdoc.html">README</a>
</ul>
</div>
</div>
</nav>
<main role="main" aria-label="Page README.rdoc">
<h1 id="label-memcache-client">memcache-client<span><a href="#label-memcache-client">¶</a> <a href="#top">↑</a></span></h1>
<p>A ruby library for accessing memcached.</p>
<p>Source:</p>
<p><a href="http://github.com/mperham/memcache-client">github.com/mperham/memcache-client</a></p>
<h2 id="label-Installing+memcache-client">Installing memcache-client<span><a href="#label-Installing+memcache-client">¶</a> <a href="#top">↑</a></span></h2>
<p>Just install the gem:</p>
<pre>$ sudo gem install memcache-client</pre>
<h2 id="label-Using+memcache-client">Using memcache-client<span><a href="#label-Using+memcache-client">¶</a> <a href="#top">↑</a></span></h2>
<p>With one server:</p>
<pre class="ruby"><span class="ruby-constant">CACHE</span> = <span class="ruby-constant">MemCache</span>.<span class="ruby-identifier">new</span> <span class="ruby-string">'localhost:11211'</span>
</pre>
<p>Or with multiple servers:</p>
<pre class="ruby"><span class="ruby-constant">CACHE</span> = <span class="ruby-constant">MemCache</span>.<span class="ruby-identifier">new</span> <span class="ruby-node">%w[one.example.com:11211 two.example.com:11211]</span>
</pre>
<h2 id="label-Tuning+memcache-client">Tuning memcache-client<span><a href="#label-Tuning+memcache-client">¶</a> <a href="#top">↑</a></span></h2>
<p>The <a href="MemCache.html#method-c-new"><code>MemCache.new</code></a> method takes a number of options which can be useful at times. Please read the source comments there for an overview. If you are using Ruby 1.8.x and using multiple memcached servers, you should install the RubyInline gem for ultimate performance.</p>
<h2 id="label-Using+memcache-client+with+Rails">Using memcache-client with Rails<span><a href="#label-Using+memcache-client+with+Rails">¶</a> <a href="#top">↑</a></span></h2>
<p>Rails 2.1+ includes memcache-client 1.5.0 out of the box. See ActiveSupport::Cache::MemCacheStore and the Rails.cache method for more details. Rails 2.3+ will use the latest memcache-client gem installed.</p>
<h2 id="label-Using+memcache-client+with+EventMachine">Using memcache-client with EventMachine<span><a href="#label-Using+memcache-client+with+EventMachine">¶</a> <a href="#top">↑</a></span></h2>
<p>memcache-client 1.8.0 added support for native EventMachine connections using Ruby 1.9. If you are using an EventMachine-based application (e.g. thin), you can activate the EventMachine support like so:</p>
<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'memcache'</span>
<span class="ruby-identifier">require</span> <span class="ruby-string">'memcache/event_machine'</span>
<span class="ruby-constant">EM</span>.<span class="ruby-identifier">run</span> <span class="ruby-keyword">do</span>
<span class="ruby-constant">Fiber</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword">do</span>
<span class="ruby-identifier">m</span> = <span class="ruby-constant">MemCache</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">'localhost:11211'</span>)
<span class="ruby-identifier">m</span>.<span class="ruby-identifier">set</span> <span class="ruby-string">'abc'</span>, <span class="ruby-string">'xyz'</span>
<span class="ruby-identifier">m</span>.<span class="ruby-identifier">get</span> <span class="ruby-string">'abc'</span>
<span class="ruby-keyword">end</span>.<span class="ruby-identifier">resume</span>
<span class="ruby-keyword">end</span>
</pre>
<h2 id="label-Questions-3F">Questions?<span><a href="#label-Questions-3F">¶</a> <a href="#top">↑</a></span></h2>
<p>memcache-client is maintained by Mike Perham and was originally written by Bob Cottrell, Eric Hodel and the seattle.rb crew.</p>
<dl class="rdoc-list note-list"><dt>Email
<dd>
<p><a href="mailto:mperham@gmail.com">mperham@gmail.com</a></p>
</dd><dt>Twitter
<dd>
<p><a href="http://twitter.com/mperham">mperham</a></p>
</dd><dt>WWW
<dd>
<p><a href="http://mikeperham.com">mikeperham.com</a></p>
</dd></dl>
<p>If my work on memcache-client is something you support, please take a moment to recommend me at <a href="http://workingwithrails.com/person/10797-mike-perham">WWR</a>. I'm not asking for money, just a electronic “thumbs up”.</p>
</main>
<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.3.3.
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
</footer>