Cache Service¶
Meaning of Cache¶
Cache is a function where the object can be saved by using memory on application server.It is possible to improve the performance of application by caching the acquired results such as database access, file access, etc.
Specifications¶
By default, EHCache is used as implementation Cache.Refer to http://ehcache.org for EHCache.The object registered in Cache is discarded when the upper limit of the number of components or size specified in the configuration file is exceeded.Moreover, the object will be discarded if the validity period is exceeded.When using Cache, it is necessary to place the xml file of any name under the <CONTEXT_PATH>/WEB-INF/conf/im-ehcache-config/folder for that Cache settings.Following is an example of configuration file.<?xml version="1.0" encoding="UTF-8"?> <im-ehcache-config xmlns="http://www.intra-mart.jp/cache/ehcache/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.intra-mart.jp/cache/ehcache/config im-ehcache-config.xsd "> <cache name="myCache" enable="true" max-bytes-memory="10m" max-elements-on-memory="100" overflow-to-disk="true" max-bytes-disk="50m" max-elements-on-disk="500" time-to-idle-seconds="600" time-to-live-seconds="3600"/> </im-ehcache-config>Warning
Save it with the character encoding as UTF-8.Following are the details for each setting.
Attribute name Description name Sets the Cache name. enable Specifies true or false. When specified as false, the corresponding Cache is disabled. max-btyes-memory Specifies the maximum size for storing an object in memory. 1k, 10M, 50G, etc. can be declared. max-elements-on-memory Specifies the maximum number of objects that can be cached in memory overflow-to-disk Configures whether to write in disk when data cached in memory; exceeds the upper limit. max-bytes-disk Specifies the maximum size for storing an object in disk. 1k, 10M, 50G, etc., can be declared. max-elements-on-disk Specifies the maximum number of objects that can be cached in disk. time-to-idle-seconds Specifies idle period (seconds). If an object is not referred in specified time, it will be discarded. time-to-live-seconds Specifies life span (seconds). The object will be discarded if the specified life span exceeds.