Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(8)  |  Call(6)  |  Derive(0)  |  Import(2)

src/p/e/PerformanceEngine-HEAD/tests/test/test_query.py   PerformanceEngine(Download)
from google.appengine.api import memcache
from google.appengine.ext import testbed
from PerformanceEngine import pdb,cachepy,_deserialize
from models import PdbModel
 
  def test_fetch(self):
    db_models = self.query.fetch(100,_cache=['local','memcache'])
    cache_key = self.query.key_name
    memcache_models = _deserialize(memcache.get(cache_key))
    local_models = cachepy.get(cache_key)
    db_models = self.query.fetch(100,offset=50,_cache=['local','memcache'])
    cache_key = self.query.key_name
    memcache_models = _deserialize(memcache.get(cache_key))
    local_models = cachepy.get(cache_key)
 
  def test_get(self):
    db_entity = self.query.get(_cache=['local','memcache'])
    cache_key = self.query.key_name
    memcache_entity = _deserialize(memcache.get(cache_key))[0]
    local_entity = cachepy.get(cache_key)[0]
    db_entity = self.query.get(offset=50,_cache=['local','memcache'])
    cache_key = self.query.key_name
    memcache_entity = _deserialize(memcache.get(cache_key))[0]
    local_entity = cachepy.get(cache_key)[0]
 

src/p/e/PerformanceEngine-HEAD/tests/test/test_pdb.py   PerformanceEngine(Download)
from google.appengine.api import memcache
from google.appengine.ext import testbed
from PerformanceEngine import pdb,_serialize,_deserialize,cachepy
from models import TestModel
 
  def test_put_memcache(self):  
    model = TestModel(key_name='test_key_name',name='test')
    key = pdb.put(model,_storage='memcache')
    entity = _deserialize(memcache.get(str(key)))
    self.assertEqual('test', entity.name)
  def test_delete_memcache(self):  
    pdb.delete(self.setup_key,_storage='memcache')
    entity = _deserialize(memcache.get(self.cache_key))
    self.assertEqual(entity , None)