You are looking at documentation for an older release. Not what you want? See the current release documentation.
All applications on the top of eXo JCR that need a cache, can rely
on an org.exoplatform.services.cache.ExoCache
instance that
is managed by the
org.exoplatform.services.cache.CacheService
. The main
implementation of this service is
org.exoplatform.services.cache.impl.CacheServiceImpl
which
depends on the
org.exoplatform.services.cache.ExoCacheConfig
in order to
create new ExoCache
instances. See the below example of
org.exoplatform.services.cache.CacheService
definition:
<component>
<key>org.exoplatform.services.cache.CacheService</key>
<jmx-name>cache:type=CacheService</jmx-name>
<type>org.exoplatform.services.cache.impl.CacheServiceImpl</type>
<init-params>
<object-param>
<name>cache.config.default</name>
<description>The default cache configuration</description>
<object type="org.exoplatform.services.cache.ExoCacheConfig">
<field name="name"><string>default</string></field>
<field name="maxSize"><int>300</int></field>
<field name="liveTime"><long>600</long></field>
<field name="implementation"><string>org.exoplatform.services.cache.concurrent.ConcurrentFIFOExoCache</string></field>
</object>
</object-param>
</init-params>
</component>
The ExoCacheConfig
that has the name
"default" will be the default configuration of all the
ExoCache
instances.
See the below example about how to define a new
ExoCacheConfig
via an external-component-plugin:
<external-component-plugins>
<target-component>org.exoplatform.services.cache.CacheService</target-component>
<component-plugin>
<name>addExoCacheConfig</name>
<set-method>addExoCacheConfig</set-method>
<type>org.exoplatform.services.cache.ExoCacheConfigPlugin</type>
<description>Configures the cache for SEO service</description>
<init-params>
<object-param>
<name>cache.config.wcm.seo</name>
<description>The cache configuration for SEO</description>
<object type="org.exoplatform.services.cache.ExoCacheConfig">
<field name="name">
<string>wcm.seo</string>
</field>
<field name="maxSize">
<int>${wcm.cache.seoservice.capacity:300}</int>
</field>
<field name="liveTime">
<long>${wcm.cache.seoservice.timetolive:600}</long>
</field>
<field name="implementation">
<string>org.exoplatform.services.cache.concurrent.ConcurrentFIFOExoCache</string>
</field>
</object>
</object-param>
</init-params>
</component-plugin>
</external-component-plugins>
name | Name of the cache. This field is mandatory since it
will be used to retrieve the ExoCacheConfig
corresponding to a given cache name. |
label | Label of the cache. This field is optional. It is mainly used to indicate the purpose of the cache. |
maxSize | The maximum numbers of elements in cache. This field is mandatory. |
liveTime | The amount of time (in seconds) that an element is not written or read before it is evicted. This field is mandatory. |
implementation | The full qualified name of the cache implementation to use.
This field is optional. This field is only used for simple cache
implementation. The default and main implementation is
org.exoplatform.services.cache.concurrent.ConcurrentFIFOExoCache
that only works with local caches with FIFO as eviction policy.
For more complex implementation, see the next sections. |
logEnabled | Indicates if the log is enabled. This field is optional. This field is used for backward compatibility. |