本文整理汇总了Python中gluon.contrib.memcache.memcache.Client.get方法的典型用法代码示例。如果您正苦于以下问题:Python Client.get方法的具体用法?Python Client.get怎么用?Python Client.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gluon.contrib.memcache.memcache.Client
的用法示例。
在下文中一共展示了Client.get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: increment
# 需要导入模块: from gluon.contrib.memcache.memcache import Client [as 别名]
# 或者: from gluon.contrib.memcache.memcache.Client import get [as 别名]
def increment(self, key, value=1, time_expire=300):
newKey = self.__keyFormat__(key)
obj = Client.get(self, newKey)
if obj:
return Client.incr(self, newKey, value)
else:
Client.set(self, newKey, value, time_expire)
return value
示例2: increment
# 需要导入模块: from gluon.contrib.memcache.memcache import Client [as 别名]
# 或者: from gluon.contrib.memcache.memcache.Client import get [as 别名]
def increment(self, key, value=1, time_expire=DEFAULT_TIME_EXPIRE):
""" time_expire is ignored """
newKey = self.__keyFormat__(key)
obj = Client.get(self, newKey)
if obj:
if isinstance(obj,(int,double,long)):
return Client.incr(self, newKey, value)
else:
value += obj[1]
Client.set(self,newKey,(time.time(),value),
self.max_time_expire)
return value
else:
Client.set(self, newKey, value, self.max_time_expire)
return value
示例3: increment
# 需要导入模块: from gluon.contrib.memcache.memcache import Client [as 别名]
# 或者: from gluon.contrib.memcache.memcache.Client import get [as 别名]
def increment(self, key, value=1, time_expire='default'):
""" time_expire is ignored """
if time_expire == 'default':
time_expire = self.default_time_expire
newKey = self.__keyFormat__(key)
obj = Client.get(self, newKey)
if obj:
if isinstance(obj,(int,float,long)):
return Client.incr(self, newKey, value)
else:
value += obj[1]
Client.set(self,newKey,(time.time(),value),
self.max_time_expire)
return value
else:
Client.set(self, newKey, value, self.max_time_expire)
return value
示例4: get
# 需要导入模块: from gluon.contrib.memcache.memcache import Client [as 别名]
# 或者: from gluon.contrib.memcache.memcache.Client import get [as 别名]
def get(self,key):
newKey = self.__keyFormat__(key)
return Client.get(self,newKey)