We are planning an ehcache-googleappengine module which will integrate the speed of Ehcache with the scale of Google's Cache Infrastructure and provide the best of both worlds. Check http://ehcache.org regularly for updates.
Ehcache is compatible and works with Google App Engine.
Google App Engine provides a constrained runtime which restricts networking, threading and file system access.
All features of Ehcache can be used except for the DiskStore and replication. Having said that, there are workarounds for these limitations. See the Recipes section below.
As of June 2009, Google App Engine appears to be limited to a heap size of 100MB. (See http://gregluck.com/blog/archives/2009/06/the_limitations.html for the evidence of this).
Version 1.6 and higher of Ehcache is compatible with Google App Engine.
Version 1.7.1 makes the CacheLoaders in Ehcache compatible with Google App Engine.
Older versions will not work.
Make sure the following elements are commented out:
Within each cache element, ensure that:
Copy and past this one to get started.
<?xml version="1.0" encoding="UTF-8"?>
<Ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd" >
<cacheManagerEventListenerFactory class="" properties=""/>
<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="false"
diskPersistent="false"
memoryStoreEvictionPolicy="LRU"
/>
<!--Example sample cache-->
<cache name="sampleCache1"
maxElementsInMemory="10000"
maxElementsOnDisk="1000"
eternal="false"
timeToIdleSeconds="300"
timeToLiveSeconds="600"
memoryStoreEvictionPolicy="LFU"
/>
</ehcache>The idea here is that your caches are set up in a cache hierarchy. Ehcache sits in front and memcacheg behind. Combining the two lets you elegantly work around limitations imposed by Googe App Engine. You get the benefits of the �s speed of Ehcache together with the umlimited size of memcached.
Ehcache contains the hooks to easily do this.
To update memcached, use a CacheEventListener.
To search against memcacheg on a local cache miss, use cache.getWithLoader() together with a CacheLoader for memcacheg.
In the CacheEventListener, ensure that when notifyElementEvicted() is called, which it will be when a put exceeds the MemoryStore's capacity, that the key and value are put into memcacheg.
Configure all notifications in CacheEventListener to proxy throught to memcacheg.
Any work done by one node can then be shared by all others, with the benefit of local caching of frequently used data.
Google App Engine provides acceleration for files declared static in appengine-web.xml.
e.g.
<static-files>
<include path="/**.png" />
<exclude path="/data/**.png" />
</static-files>You can get acceleration for dynamic files using Ehcache's caching filters as you usually would.
See the Web Caching chapter.