Skip to content

Instantly share code, notes, and snippets.

@aleemstreak
Created February 26, 2014 21:48
Show Gist options
  • Save aleemstreak/9239351 to your computer and use it in GitHub Desktop.
Save aleemstreak/9239351 to your computer and use it in GitHub Desktop.
List<Key<Case>> cachedCaseKeys = someFunctionToGetKeys();
Profiler p = AppstatsWrapperFilter.getProfiler();
// run the objectify test
p.start("objectify");
Map<Key<Case>, Case> results = DAO.getEntities(cachedCaseKeys);
p.end("objectify");
// setup the low level memcache
List<com.google.appengine.api.datastore.Key> keys = new ArrayList<>();
for (Key<Case> k : cachedCaseKeys) {
keys.add(KeyFactory.stringToKey(k.getString()));
}
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
Map<com.google.appengine.api.datastore.Key, Entity> ttt = datastore.get(keys);
MemcacheService ms = MemcacheServiceFactory.getMemcacheService();
ms.putAll(ttt);
// run the low level test
p.start("lowlevel");
Map<com.google.appengine.api.datastore.Key, Object> all = ms.getAll(keys);
p.end("lowlevel");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment