本文整理汇总了Python中models.PersistentCache.set_cache方法的典型用法代码示例。如果您正苦于以下问题:Python PersistentCache.set_cache方法的具体用法?Python PersistentCache.set_cache怎么用?Python PersistentCache.set_cache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.PersistentCache
的用法示例。
在下文中一共展示了PersistentCache.set_cache方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_set_cache
# 需要导入模块: from models import PersistentCache [as 别名]
# 或者: from models.PersistentCache import set_cache [as 别名]
def test_set_cache(self):
self.assertThereIsNoInstanceOf(PersistentCache)
PersistentCache.set_cache('some-cache', 'some data')
self._assert_persistent_cache('some-cache', 'some data')
PersistentCache.set_cache('some-cache', 'some other data')
self._assert_persistent_cache('some-cache', 'some other data')
示例2: test_get_cache
# 需要导入模块: from models import PersistentCache [as 别名]
# 或者: from models.PersistentCache import set_cache [as 别名]
def test_get_cache(self):
self.assertEqual(memcache.get('some-cache'), None)
self.assertEqual(PersistentCache.get_cache('some-cache'), None)
PersistentCache.set_cache('some-cache', 'some data')
self.assertEqual(memcache.get('some-cache'), 'some data')
self.assertEqual(PersistentCache.get_cache('some-cache'), 'some data')
memcache.delete('some-cache')
self.assertEqual(memcache.get('some-cache'), None)
self.assertEqual(PersistentCache.get_cache('some-cache'), 'some data')
示例3: post
# 需要导入模块: from models import PersistentCache [as 别名]
# 或者: from models.PersistentCache import set_cache [as 别名]
def post(self):
self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'
test_id, branch_id, platform_id = _get_test_branch_platform_ids(self)
branch = model_from_numeric_id(branch_id, Branch)
platform = model_from_numeric_id(platform_id, Platform)
test = model_from_numeric_id(test_id, Test)
assert branch
assert platform
assert test
PersistentCache.set_cache(Test.cache_key(test_id, branch_id, platform_id), Runs(branch, platform, test.name).to_json())
self.response.out.write('OK')
示例4: cache_runs
# 需要导入模块: from models import PersistentCache [as 别名]
# 或者: from models.PersistentCache import set_cache [as 别名]
def cache_runs(test_id, branch_id, platform_id, cache):
PersistentCache.set_cache(Test.cache_key(test_id, branch_id, platform_id), cache)
示例5: cache_dashboard
# 需要导入模块: from models import PersistentCache [as 别名]
# 或者: from models.PersistentCache import set_cache [as 别名]
def cache_dashboard(cache):
PersistentCache.set_cache('dashboard', cache)
示例6: cache_manifest
# 需要导入模块: from models import PersistentCache [as 别名]
# 或者: from models.PersistentCache import set_cache [as 别名]
def cache_manifest(cache):
PersistentCache.set_cache('manifest', cache)