You are looking at documentation for an older release. Not what you want? See the current release documentation.
In the previous versions of eXo Kernel, it was quite complex to implement your own ExoCache because it was not open enough. Since Kernel 2.0.8, it is possible to easily integrate your favorite cache provider in eXo Products.
You just need to implement your own ExoCacheFactory
and register it in an eXo container, as described below:
package org.exoplatform.services.cache;
...
public interface ExoCacheFactory {
/**
* Creates a new instance of {@link org.exoplatform.services.cache.ExoCache}
* @param config the cache to create
* @return the new instance of {@link org.exoplatform.services.cache.ExoCache}
* @exception ExoCacheInitException if an exception happens while initializing the cache
*/
public ExoCache createCache(ExoCacheConfig config) throws ExoCacheInitException;
}
As you can see, there is only one method which can be
seen as a converter of an ExoCacheConfig
to get an instance
of ExoCache
. Once you created your own implementation, you
can simply register your factory by adding a file
conf/portal/configuration.xml
with the following content:
<configuration>
<component>
<key>org.exoplatform.services.cache.ExoCacheFactory</key>
<type>org.exoplatform.tutorial.MyExoCacheFactoryImpl</type>
...
</component>
</configuration>
Since Kernel 2.3.0-CR1, if the configuration is not a sub class of
ExoCacheConfig
and the implementation given in the
configuration is the full qualified name of an existing implementation
of eXo Cache, we will assume that the user expects to have an instance
of this eXo Cache type so we will not use the configured cache
factory.