Tuesday, September 29, 2009

Datanucleus Level 2 Cache in app engine

Level 2 cache is disabled by default in Datanucleus, 
to enable it you've gotta 
  • download the cache plugin here
  • place it in your applications lib directory
  • edit your persistence.xml and add
    • <property name="datanucleus.cache.level2" value="true">
      <property name="datanucleus.cache.level2.type" value="soft">

      after

      <property name="datanucleus.ConnectionURL" value="appengine"/>
    Additional configuration options are available here.


    App engines memcache implements JCache(javax.cache) interface, but i get a serialization error when attempting to save a object.




    2 comments:

    1. do you managed to get memcache work by seetting level2 property? i cant get it run when set value to memcache. are u using jpa?

      ReplyDelete
    2. I tried "javax.cache" and when I make my entity classes Serializable, it seems to work.

      Are you sure the "soft" cache works properly, as it does not support distributed caches and GAE will cluster across many JVM?

      ReplyDelete