<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Brain Matters &#187; redis</title>
	<atom:link href="http://blog.agoragames.com/tag/redis/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.agoragames.com</link>
	<description></description>
	<lastBuildDate>Mon, 16 Aug 2010 19:36:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Experimenting with Redis</title>
		<link>http://blog.agoragames.com/2010/02/23/experimenting-with-redis/</link>
		<comments>http://blog.agoragames.com/2010/02/23/experimenting-with-redis/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 13:05:04 +0000</pubDate>
		<dc:creator>David Czarnecki</dc:creator>
				<category><![CDATA[Engineering]]></category>
		<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[redis]]></category>
		<category><![CDATA[resque]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.agoragames.com/?p=470</guid>
		<description><![CDATA[Yesterday I started looking at ways to do inter-application communication. In a number of projects we&#8217;ve done here at Agora Games, we&#8217;ve used queues to make that happen. Redis has been on my radar for awhile now, but yesterday I drove my Chevy to the levee and guess what? The levee is NOT dry people. [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I started looking at ways to do inter-application communication. In a number of projects we&#8217;ve done here at Agora Games, we&#8217;ve used queues to make that happen. <a href="http://code.google.com/p/redis/">Redis</a> has been on my radar for awhile now, but yesterday I drove my Chevy to the levee and guess what? The levee is NOT dry people. I mean, who drinks rye anyway these days? Old people.</p>
<p><span id="more-470"></span></p>
<p>Right, <a href="http://code.google.com/p/redis/">Redis</a>.</p>
<p>&#8220;Redis is an advanced key-value store. It is similar to memcached but the dataset is not volatile, and values can be strings, exactly like in memcached, but also lists, sets, and ordered sets. All this data types can be manipulated with atomic operations to push/pop elements, add/remove elements, perform server side union, intersection, difference between sets, and so forth. Redis supports different kind of sorting abilities.&#8221;</p>
<p>I was particularly interested in the support in Redis for lists, which would allow me to have one application push stuff into the datastore and allow for another application to pull stuff from the datastore. A datastore that could operate as a queue? I guess this is as close as we&#8217;re going to get to flying cars in 2010. Redis is also supposed to be wicked fast and there are a number of libraries available in your programming language of choice with which to communicate with Redis.</p>
<p>Redis setup was trivial and &#8220;just worked&#8221;.</p>
<p>After starting the Redis server, I could just prototype in script/console.</p>
<p>Here we go:</p>
<pre style="font-family: monospace;"><span>&gt;&gt;</span> redis_queue = Redis.<span>new</span>
<span>=&gt;</span> <span>#&lt;Redis:0x222df9c @thread_safe=nil, @logger=nil, @password=nil, @timeout=5, @db=0, @sock=nil, @host="127.0.0.1", @port=6379&gt;</span>
<span>&gt;&gt;</span> redis_queue.<span>push_tail</span> <span>'strings'</span>, <span>'string 1'</span>
<span>=&gt;</span> <span>"OK"
&gt;&gt; </span>redis_queue.<span>push_tail</span> <span>'strings'</span>, <span>'string 2'</span><span>
&gt;&gt;</span> <span>"OK"</span><span>
&gt;&gt;</span> redis_queue.<span>list_length</span><span>(</span><span>'strings'</span><span>)</span><span>
=&gt;</span> <span>2
&gt;&gt; </span>redis_queue.<span>list_range</span><span>(</span><span>'strings'</span>, <span>0</span>, <span>-</span><span>1</span><span>)</span>
=&gt; ["string 1", "string 2"]
&gt;&gt; some_string = redis_queue.pop_head('strings')
=&gt; "string 1"
&gt;&gt; r.list_range('strings', 0, -1)
=&gt; ["string 2"]
&gt;&gt; r.list_length('strings')
=&gt; 1
&gt;&gt; quit</pre>
<p><a href="http://code.google.com/p/redis/wiki/CommandReference">There are quite a few commands that make Redis even more awesome, but for now I&#8217;m sold</a>. (If using an entire sentence as a link is wrong then I don&#8217;t want to be right)</p>
<p>Also, I know of <a href="http://github.com/defunkt/resque#readme">Resque</a>, &#8220;a Redis-backed library for creating background jobs, placing those jobs on multiple queues, and processing them later.&#8221; If I ever feel like driving the Mercedes Benz of flying cars, I&#8217;ll use it.</p>




	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F02%2F23%2Fexperimenting-with-redis%2F&amp;title=Experimenting%20with%20Redis" title="Reddit"><img src="http://blog.agoragames.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F02%2F23%2Fexperimenting-with-redis%2F&amp;title=Experimenting%20with%20Redis&amp;bodytext=Yesterday%20I%20started%20looking%20at%20ways%20to%20do%20inter-application%20communication.%20In%20a%20number%20of%20projects%20we%27ve%20done%20here%20at%20Agora%20Games%2C%20we%27ve%20used%20queues%20to%20make%20that%20happen.%20Redis%20has%20been%20on%20my%20radar%20for%20awhile%20now%2C%20but%20yesterday%20I%20drove%20my%20Chevy%20to%20the" title="Digg"><img src="http://blog.agoragames.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F02%2F23%2Fexperimenting-with-redis%2F&amp;title=Experimenting%20with%20Redis&amp;notes=Yesterday%20I%20started%20looking%20at%20ways%20to%20do%20inter-application%20communication.%20In%20a%20number%20of%20projects%20we%27ve%20done%20here%20at%20Agora%20Games%2C%20we%27ve%20used%20queues%20to%20make%20that%20happen.%20Redis%20has%20been%20on%20my%20radar%20for%20awhile%20now%2C%20but%20yesterday%20I%20drove%20my%20Chevy%20to%20the" title="del.icio.us"><img src="http://blog.agoragames.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.agoragames.com%2F2010%2F02%2F23%2Fexperimenting-with-redis%2F&amp;t=Experimenting%20with%20Redis" title="Facebook"><img src="http://blog.agoragames.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fblog.agoragames.com%2F2010%2F02%2F23%2Fexperimenting-with-redis%2F&amp;t=Experimenting%20with%20Redis&amp;s=Yesterday%20I%20started%20looking%20at%20ways%20to%20do%20inter-application%20communication.%20In%20a%20number%20of%20projects%20we%27ve%20done%20here%20at%20Agora%20Games%2C%20we%27ve%20used%20queues%20to%20make%20that%20happen.%20Redis%20has%20been%20on%20my%20radar%20for%20awhile%20now%2C%20but%20yesterday%20I%20drove%20my%20Chevy%20to%20the" title="Tumblr"><img src="http://blog.agoragames.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Experimenting%20with%20Redis%20-%20http%3A%2F%2Fblog.agoragames.com%2F2010%2F02%2F23%2Fexperimenting-with-redis%2F" title="Twitter"><img src="http://blog.agoragames.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.agoragames.com/2010/02/23/experimenting-with-redis/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->