<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.ehcache.org/ehcache.xsd"
updateCheck="false">
<cache name="userCache"
maxEntriesLocalHeap="10000"
eternal="false"
timeToIdleSeconds="300"
timeToLiveSeconds="600"
memoryStoreEvictionPolicy="LRU"/>
</ehcache>
CacheManager cacheManager = CacheManager.create();
Cache cache = cacheManager.getCache("userCache");
Element element = new Element("userId", userData);
cache.put(element);
Element cachedElement = cache.get("userId");
UserData cachedData = (UserData) cachedElement.getObjectValue();
cache.remove("userId");
cacheManager.shutdown();