title: Pythonic wrapper for Redis with serialization
body: <p>I've tried <a href="https://github.com/ask/redish" rel="nofollow">redish</a>.
  It looks pretty good, but it seems to be dead, and there are no auth option (improved in some forks). I took a look at <a href="https://github.com/peta/redis-natives-py" rel="nofollow">redis-natives</a> and <a href="https://github.com/amix/redis_wrap" rel="nofollow">redis_wrap</a>, but it seems that there's no serialization. </p>
  
  <p>I'm not proud of my "not invented here" syndrom in the past, so i'm looking for some nice wrapper if it exists. :)</p>
  
  <p>UDP: The simplest own bicycle in django, IMHO, looks like:</p>
  
  <pre><code>from django.forms.models import model_to_dict
  import redis
  import anyjson
  
  r = redis.Redis(password=setting('REDIS_PASSWORD'))
  
  class ToRedisMixIn(object):
      def save(self, *args, **kwargs):
          super(ToRedisMixIn, self).save(*args, **kwargs)
          exclude = ['id']
          redis_exclude = getattr(self, 'redis_exclude', None)
          redis_key_name = getattr(self, 'redis_key_name', None) or '%ss' % self.__class__.__name__.lower()
          if redis_exclude:
              exclude += redis_exclude
          model_dict = model_to_dict(self, exclude=exclude)
          r.hset(redis_key_name, self.id, anyjson.serialize(model_dict))
  </code></pre>
  
  <p>Usage: </p>
  
  <pre><code>class Device(ToRedisMixIn, models.Model):
      host            = models.IPAddressField()
      name            = models.CharField(max_length=32)
      description     = models.CharField(max_length=200, blank=True)
  
      redis_exclude = ['description']
      redis_key_name = 'devices'
  </code></pre>
  
  <p>Not best, but works.</p>