本文整理匯總了Python中models.PersistentCache類的典型用法代碼示例。如果您正苦於以下問題:Python PersistentCache類的具體用法?Python PersistentCache怎麽用?Python PersistentCache使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了PersistentCache類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_set_cache
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
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
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: get
def get(self):
self.response.headers['Content-Type'] = 'application/json'
dashboard = PersistentCache.get_cache('dashboard')
if dashboard:
self.response.out.write(dashboard)
else:
schedule_dashboard_update()
示例5: _assert_persistent_cache
def _assert_persistent_cache(self, name, value):
self.assertEqual(PersistentCache.get_by_key_name(name).value, value)
self.assertEqual(memcache.get(name), value)
示例6: cache_runs
def cache_runs(test_id, branch_id, platform_id, cache):
PersistentCache.set_cache(Test.cache_key(test_id, branch_id, platform_id), cache)
示例7: cache_dashboard
def cache_dashboard(cache):
PersistentCache.set_cache('dashboard', cache)
示例8: cache_manifest
def cache_manifest(cache):
PersistentCache.set_cache('manifest', cache)