The Business and Enterprise Editions of KonaKart provide functionality to configure caches for a growing number of KonaKart objects.
By default the Open Source Ehcache cache is used which can be configured in the konakart_ehcache.xml configuration file. This file is located in the webapps/konakart/WEB-INF/classes directory of a standard installation.
Three cache types are currently available with different characteristics:
Ehcache - the default cache. This allows very flexible configuration in konakart_ehcache.xml and stores serialized objects on the JVM heap.
Big Memory Go - the Terracotta cache. This allows very flexible configuration in konakart_ehcache.xml, stores serialized objects and can store the cache off the JVM heap thereby utilising up to 32Gb of memory space. This gives you an opportunity to store very large caches in memory without being restricted by the standard JVM heap limit on your platform. To use the free version of the Big Memory Go cache you need to obtain a license key from Terracotta (see below for details).
KonaKart cache - this is the highest performance cache since it stores java objects so no serialization/de-serialization is required. The disadvantages are that there are no configuration or monitoring options and the data must be held on the JVM heap (so there are restrictions in how much data can be stored).
Currently there are two caches supported but the number is likely to grow in the future as more opportunities for improving performance are implemented:
Product Cache - a cache of complete products
Product Image Names Cache - a cache for storing the set of image names that have been defined for a product.
In the Configuration >> Cache panel in the Administration Application you can choose to enable or disable each of the above two caches.
To use the KonaKart cache simply remove the konakart_ehcache.xml file (if that file is found on the classpath an Ehcache cache will be used).
To use a Big Memory Go cache you need to take the following steps:
Follow the instructions here: http://terracotta.org/documentation/4.0/bigmemorygo/get-started
Replace the ehcache jar used in KonaKart with the ehcache-ee-* jar in BigMemoryGo.
Add the bigmemory-* jar to the konakart webapp lib directory
Obtain a license key file for using BigMemory Go and add it to the classpath (eg. add it to webapps/konakart/WEB-INF/classes
Configure the konakart_ehcache.xml file according to your requirements (eg add Off Heap caching) EG:
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd" name="KonaKart-Ehcache" updateCheck="true" monitoring="off" dynamicConfig="false" maxBytesLocalHeap="1M" maxBytesLocalOffHeap="2G">
Add -XX:MaxDirectMemorySize=4G to your JVM initialisation parameters (or equivalent setting for your platform).
Use the BigMemory Go Management Console to manage the Cache if required.
If you need more control over which products are cached and which are not you can create your own version of the ProductMgr and override the cacheThisProduct product. This method takes a product as an argument and returns true if the product should be cached and false if not. An example of such a ProductMgr class is provided at "java_api_examples\src\com\konakart\apiexamples\MyProductMgrEE.java".