<?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>The Code Dreamer : Nitin Hayaran &#187; MemCached</title>
	<atom:link href="http://www.nitinh.com/category/memcached/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nitinh.com</link>
	<description>Nitin Hayaran&#039;s Blog</description>
	<lastBuildDate>Sun, 29 Jan 2012 07:28:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Installing Memcached for Django Application on Windows XP</title>
		<link>http://www.nitinh.com/2009/02/installing-memcached-for-django-application-on-windows-xp/</link>
		<comments>http://www.nitinh.com/2009/02/installing-memcached-for-django-application-on-windows-xp/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 04:18:00 +0000</pubDate>
		<dc:creator>nitin</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[MemCached]]></category>
		<category><![CDATA[memcache]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[win32]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[windows XP]]></category>
		<category><![CDATA[windowsXP]]></category>

		<guid isPermaLink="false">http://www.nitinh.com/2009/02/installing-memcached-for-django-application-on-windows-xp/</guid>
		<description><![CDATA[TweetShareFor a project I needed Memcached. But the problem was that I have my development system on WindowsXP. When I Google I got various links to install Memcached on windows, but there wasn't any link that tell all about Memcached with Django on Windows So Here we go: Download memcached 1.2.4 Win32. Unzip the binaries [...]


Related posts:<ol><li><a href='http://www.nitinh.com/2009/02/why-django-orm-sucks-it-takes-a-hell-lot-of-memory-in-processing/' rel='bookmark' title='Permanent Link: Why Django ORM Sucks : It takes a hell lot of memory in processing.'>Why Django ORM Sucks : It takes a hell lot of memory in processing.</a></li>
<li><a href='http://www.nitinh.com/2009/03/debugging-django-on-windows-developement-setup/' rel='bookmark' title='Permanent Link: Debugging Django on Windows : Developement Setup'>Debugging Django on Windows : Developement Setup</a></li>
<li><a href='http://www.nitinh.com/2009/02/django-orm-what-to-do-when-the-memory-requirement-goes-high/' rel='bookmark' title='Permanent Link: Django ORM : What to do when the memory requirement goes high?'>Django ORM : What to do when the memory requirement goes high?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button-left"><a href="http://twitter.com/share" class="twitter-share-button" data-count="vertical" data-via="socializeWP" data-url="http://www.nitinh.com/2009/02/installing-memcached-for-django-application-on-windows-xp/">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div class="socialize-in-button-left"><a name="fb_share" type="box_count" share_url="http://www.nitinh.com/2009/02/installing-memcached-for-django-application-on-windows-xp/" href="http://www.facebook.com/sharer.php">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script></div></div><p>For a project I needed Memcached. But the problem was that I have my development system on WindowsXP.</p>
<p><span id="more-24"></span></p>
<p>When I Google I got various links to install Memcached on windows, but there wasn't any link that tell all about <strong>Memcached with Django on Windows</strong></p>
<p>So Here we go:</p>
<li>Download <a href="http://www.splinedancer.com/memcached-win32/memcached-1.2.4-Win32-Preview-20080309_bin.zip"><a href="http://www.splinedancer.com/memcached-win32/memcached-1.2.4-Win32-Preview-20080309_bin.zip">memcached 1.2.4 Win32</a></a>.</li>
<li>Unzip the binaries in your desired directory (eg. c:\memcached)</li>
<li>Install the service using the command: 'c:\memcached\memcached.exe -d install' from either the command line</li>
<li>Start the server from the Microsoft Management Console or by running the following command: 'c:\memcached\memcached.exe -d start'</li>
<li>Use the server, by default listening to port 11211</li>
<li>Now we have to get something so that python can talk with our memcached server. For this we have various options, but the easiest is python-memcache</li>
<li>Grap latest file from <a href="ftp://ftp.tummy.com/pub/python-memcached/python-memcached-latest.tar.gz">python-memcached-latest.tar.gz</a></li>
<li>Extract the compressed files in a directory say C:\python-memcache\</li>
<li>Now Run "python setup.py install"</li>
<p>So till this point the installation part is done. Now the question comes how to use it in Django application.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> django.<span style="color: black;">core</span>.<span style="color: black;">cache</span> <span style="color: #ff7700;font-weight:bold;">import</span> cache
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #dc143c;">test</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
	cache_key = <span style="color: #483d8b;">'myID'</span>
	result = cache.<span style="color: black;">get</span><span style="color: black;">&#40;</span>qstr_key<span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">if</span> result <span style="color: #ff7700;font-weight:bold;">is</span> <span style="color: #008000;">None</span>:
		<span style="color: #483d8b;">&quot;&quot;&quot;Not Found in Cache&quot;&quot;&quot;</span>
		data = <span style="color: #483d8b;">'hello'</span>
		cache.<span style="color: #008000;">set</span><span style="color: black;">&#40;</span>cache_key, data, <span style="color: #ff4500;">86400</span><span style="color: black;">&#41;</span></pre></div></div>

<p>So Basically we have two functions here :<br />
<strong>cache.set<br />
cache.get</strong></p>
<p>Go and enjoy the benefit of memcached</p>


<p>Related posts:<ol><li><a href='http://www.nitinh.com/2009/02/why-django-orm-sucks-it-takes-a-hell-lot-of-memory-in-processing/' rel='bookmark' title='Permanent Link: Why Django ORM Sucks : It takes a hell lot of memory in processing.'>Why Django ORM Sucks : It takes a hell lot of memory in processing.</a></li>
<li><a href='http://www.nitinh.com/2009/03/debugging-django-on-windows-developement-setup/' rel='bookmark' title='Permanent Link: Debugging Django on Windows : Developement Setup'>Debugging Django on Windows : Developement Setup</a></li>
<li><a href='http://www.nitinh.com/2009/02/django-orm-what-to-do-when-the-memory-requirement-goes-high/' rel='bookmark' title='Permanent Link: Django ORM : What to do when the memory requirement goes high?'>Django ORM : What to do when the memory requirement goes high?</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.nitinh.com/2009/02/installing-memcached-for-django-application-on-windows-xp/feed/</wfw:commentRss>
		<slash:comments>7</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! -->
