**NOTE**: If you'd like to install this locally, you'll need to have the``libmemcached-dev`` libraries installed for this to compile properly. OnDebian and Ubuntu you can install this by running ``sudo aptitude -y installlibmemcached-dev``. If you're using a Mac, you can use[homebrew](http://mxcl.github.com/homebrew/) and run ``brew install libmemcached``.

## Usage

Modify your Django ``settings.py`` file, and set:

``` pythonfrom memcacheify import memcacheify

CACHES = memcacheify()```

Next, edit your ``requirements.txt`` file (which Heroku reads) and add``pylibmc==1.2.3`` to the bottom of the file. This is required for Heroku todetect the necessary C dependencies and 'bootstrap' your application. This requirementhas to be in the root ``requirements.txt`` file, not in any imported requirements.([Solution from Stack Overflow](http://stackoverflow.com/questions/11507639/memcached-on-heroku-w-django-cant-install-pylibmc-memcacheify/11587142#11587142))

Assuming you have a memcache server available to your application on Heroku, itwill instantly be available. If you have no memcache addon provisioned for yourapp, ``memcacheify`` will default to using local memory caching as a backup :)

## Heroku Setup

Now that you've got Django configured to use memcache, all you need to do isinstall one memcache addons that Heroku provides!

The example above will provision a *free* 25m memcache server for yourapplication. Assuming everything worked, ``heroku config``'s output should showthat you now have 3 new environment variables set.

## Local DevelopmentIf you have a memcached server locally for development that doesn't supportauthentication, you can still use memcache by setting an environment variable`MEMCACHEIFY_USE_LOCAL=True`.

This will set the default cache to `django_pylibmc.memcached.PyLibMCCache`

If there are no environment variables for memcache or memcacheify, the defaultcache will be local memory `django.core.cache.backends.locmem.LocMemCache`.

## Testing Your Cache

If you don't trust me, and want to make sure your caching is working asexpected, you may do the following: