码迷,mamicode.com
首页 > 编程语言 > 详细

python redis 简单使用类

时间:2015-04-05 06:49:23      阅读:229      评论:0      收藏:0      [点我收藏+]

标签:

#!/usr/bin/python
#coding=utf-8


import redis

class urlList():

#############################################
# create by myjack
# you can call the function by urlList Class.
# vertion : v-01
# date : 2015-4-5
#############################################

    def __init__(self):
        self.pool    = redis.ConnectionPool(host=‘localhost‘, port=6379, db=0)
        self.Redis   = redis.Redis(connection_pool = self.pool)

    def pushLink(self,rlist,value):
        self.Redis.lpush(rlist,value)

    def popLink(self,rlist,value):
        self.Redis.lpush(rlist,value)

    def lenList(self,rlist):
        return self.Redis.llen(rlist)

    def delList(self,rlist):
        self.Redis.delete(rlist)


python redis 简单使用类

标签:

原文地址:http://my.oschina.net/xiaomianyang/blog/396198

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!