1.11.1. Basic concepts

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:

        <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> 


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:

        <description>Configures the cache for SEO service</description>
                <description>The cache configuration for SEO</description>
                <object type="org.exoplatform.services.cache.ExoCacheConfig">
                    <field name="name">
                    <field name="maxSize">
                    <field name="liveTime">
                    <field name="implementation">

nameName of the cache. This field is mandatory since it will be used to retrieve the ExoCacheConfig corresponding to a given cache name.
labelLabel of the cache. This field is optional. It is mainly used to indicate the purpose of the cache.
maxSizeThe maximum numbers of elements in cache. This field is mandatory.
liveTimeThe amount of time (in seconds) that an element is not written or read before it is evicted. This field is mandatory.
implementationThe 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.
logEnabledIndicates if the log is enabled. This field is optional. This field is used for backward compatibility.

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus