Level2 cache might be what you want, but anyway, just to add to the dialog, I tinkered with what's available in datanucleus-core v1.1.5. Choices in datanucleus are: none, soft, and weak (jcache is not available in any version, but see below for customization)
In addition to those, one can make a class that implements Level2Cache by adopting the connectors that you see in the src code for WeakLevel2Cache.java. If implementing your own Level2Cache, you can, for example, use Google's MapMaker in Guava for finer control of expiration: http://guava-libraries.googlecode.com/svn/trunk/javadoc/com/google/common/collect/MapMaker.html If you pursue a custom implementation, you'll have to edit datanucleus-core-1.1.5.jar's plugin.xml to add the new class and name for it. http://www.datanucleus.org/extensions/level2_cache.html http://grepcode.com/file_/repo1.maven.org/maven2/org.datanucleus/datanucleus-core/1.1.5/org/datanucleus/cache/WeakLevel2Cache.java/?v=source Here's a quick check I used in development and production to assert that the level2 cache works in appengine (presumably by container, and not yet distributed, not sure...) /* * Level 1 Cache - caching of instances within a PersistenceManager * Level 2 Cache - caching of instances within all PersistenceManagers of a PersistenceManagerFactory, */ /* * Add this to jdoconfig.xml or change yours for the level2 entries: * * <persistence-manager-factory name="l2cache"> <property name="javax.jdo.PersistenceManagerFactoryClass" value="org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory"/ > <property name="javax.jdo.option.ConnectionURL" value="appengine"/> <property name="javax.jdo.option.NontransactionalRead" value="true"/> <property name="javax.jdo.option.NontransactionalWrite" value="true"/> <property name="javax.jdo.option.RetainValues" value="true"/> <property name="datanucleus.appengine.autoCreateDatastoreTxns" value="true"/> <property name="datanucleus.cache.level2" value="true"/ > <property name="datanucleus.cache.level2.type" value="weak"/> <property name="datanucleus.cache.level1.type" value="weak"/> </persistence-manager-factory> */ PersistenceManagerFactory pmf = null; PersistenceManager pm = null; Transaction tx = null; Event event1 = null; try { pmf = JDOHelper.getPersistenceManagerFactory("l2cache"); pm = pmf.getPersistenceManager(); tx = pm.currentTransaction(); DataStoreCache l2Cache = pmf.getDataStoreCache(); l2Cache.pinAll(true, Event.class); tx.begin(); event1 = createEvent1(); pm.makePersistent(event1); tx.commit(); } catch (Exception e) { e.printStackTrace(); e.printStackTrace(out); } finally { if (tx.isActive()) { tx.rollback(); } if (pm != null) { pm.close(); } log.info("wrote 1 event to PM"); } Level2Cache l2Cache = ((JDODataStoreCache)pmf.getDataStoreCache()).getLevel2Cache(); int nObjectsInCache = l2Cache.getSize(); int nPinnedObjects = l2Cache.getNumberOfPinnedObjects(); int nUnpinnedObjects = l2Cache.getNumberOfUnpinnedObjects(); log.info("tx is closed:"); log.info("number of objects in Level2Cache is " + nObjectsInCache); log.info("number of pinned objects in Level2Cache is " + nPinnedObjects); log.info("number of unpinned objects in Level2Cache is " + nUnpinnedObjects); l2Cache.evictAll(); nObjectsInCache = l2Cache.getSize(); nPinnedObjects = l2Cache.getNumberOfPinnedObjects(); nUnpinnedObjects = l2Cache.getNumberOfUnpinnedObjects(); log.info("number of objects in Level2Cache is " + nObjectsInCache); log.info("number of pinned objects in Level2Cache is " + nPinnedObjects); log.info("number of unpinned objects in Level2Cache is " + nUnpinnedObjects); On Oct 3, 5:14 am, "nicanor.babula" <nicanor.bab...@gmail.com> wrote: > Thanks for your help. I'll go with Ian's suggestion, storing arrays in the > memcache. -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.