Skip to content

Instantly share code, notes, and snippets.

@balyanrobin
Forked from gradetwo/__init__.py
Created December 20, 2013 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save balyanrobin/8058186 to your computer and use it in GitHub Desktop.
Save balyanrobin/8058186 to your computer and use it in GitHub Desktop.
import redis
class RedisStorage(object):
_redis_pool = {}
@classmethod
def setup_redis_pool(cls, redis_pool):
for k, v in redis_pool.iteritems():
cls._redis_pool[k] = redis.Redis(v[0], v[1])
def _get_db(self, db_name):
return self._redis_pool.get(db_name, None)
class CommentRedis(RedisStorage):
def add_comment(self, checkin_id, comment_id, comment_data):
r_client = self._get_db("COMMENT")
# u can use redis now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment