本文整理汇总了Python中celery.datastructures.LocalCache.get方法的典型用法代码示例。如果您正苦于以下问题:Python LocalCache.get方法的具体用法?Python LocalCache.get怎么用?Python LocalCache.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类celery.datastructures.LocalCache
的用法示例。
在下文中一共展示了LocalCache.get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DummyClient
# 需要导入模块: from celery.datastructures import LocalCache [as 别名]
# 或者: from celery.datastructures.LocalCache import get [as 别名]
class DummyClient(object):
def __init__(self, *args, **kwargs):
self.cache = LocalCache(5000)
def get(self, key, *args, **kwargs):
return self.cache.get(key)
def set(self, key, value, *args, **kwargs):
self.cache[key] = value
示例2: DummyClient
# 需要导入模块: from celery.datastructures import LocalCache [as 别名]
# 或者: from celery.datastructures.LocalCache import get [as 别名]
class DummyClient(object):
def __init__(self, *args, **kwargs):
self.cache = LocalCache(5000)
def get(self, key, *args, **kwargs):
return self.cache.get(key)
def get_multi(self, keys):
cache = self.cache
return dict((k, cache[k]) for k in keys if k in cache)
def set(self, key, value, *args, **kwargs):
self.cache[key] = value
def delete(self, key, *args, **kwargs):
self.cache.pop(key, None)