Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

...

...

...

...

...

...

Table of Contents
outlinetrue

Ehcache integration

Caches can be configured in Ehcache either declaratively, XML or programatically. 

Integration with ehcache.

 Required dependencies :

Code Block
[group: 'net.sf.ehcache', name: 'ehcache', version: '2.7.2']

...

Here I've configured seven inmemory caches. More configuration details can be found in the ehcache configuration documentation.

Configuration parameter details

  • timeToLive

    The maximum number of seconds an element can exist in the cache regardless of use. The element expires at this limit and will no longer be returned from the cache. The default value is 0, which means no TTL eviction takes place (infinite lifetime).

  • timeToIdle

    The maximum number of seconds an element can exist in the cache without being accessed. The element expires at this limit and will no longer be returned from the cache. The default value is 0, which means no TTI eviction takes place (infinite lifetime).

  • eternal 
     when set to "true", overrides timeToLive and timeToIdle so that no expiration can take place.

  • maxEntriesLocalHeap
     Sets the maximum number of objects that will be held on heap memory. 0 = no limit.

...

If we need to switch to a disk based cache storage then it is mandatory to implement java.io.serializable interface by  the candidate cache objects. 

Integration with ehcache enterprise

Ehcache enterprise is a solution to distributed cache storage which is not provided in the general ehcache distribution. Now enterprise version is bundled with BigMemomry MAX - an in memory data management platform.

...

 More configuration details can be found on the distributed ehcache configuration documentation.

 

Screen shots of Terracotta Management console

 

 

Memcached integration 

Memcached is a widely used, FOS, high performance, in memory object caching framework. I had to change the previously chosen key values a little bit to suit memcached framework requirements.

...

  •  memcached throws away data that is least recently used. (LRU)

Memcached management console

PhpmemcachedAdmin is a handy tool to monitor memcached instances it is still in the beta version.

Cached API collection - POSTMAN

I've created a postman collection for cached API end points. One can easily import them to POSTMAN and check the performance improvement by observing the request time. 

Download link

Additional resources

...