To set up a new cache for your directory, wether for your vocabularies, users or groups:
Contribute a new XML extension that defines your cache:
For a Java memory cache:
<extension target="org.nuxeo.ecm.core.cache.CacheService" point="caches"> <cache name="MYDIRECTORY-ENTRY-CACHE" class="org.nuxeo.ecm.core.cache.InMemoryCacheImpl"> <ttl>20</ttl><!-- minutes --> <option name="maxSize">100</option> <option name="concurrencyLevel">500</option> </cache> <cache name="MYDIRECTORY-ENTRY-CACHE-WITHOUT-REFERENCES" class="org.nuxeo.ecm.core.cache.InMemoryCacheImpl"> <option name="maxSize">100</option> <ttl>20</ttl><!-- minutes --> <option name="concurrencyLevel">500</option> </cache> </extension>
For a Redis cache:
<extension target="org.nuxeo.ecm.core.cache.CacheService" point="caches"> <cache name="MYDIRECTORY-ENTRY-CACHE" class="org.nuxeo.ecm.core.redis.contribs.RedisCache"> <ttl>20</ttl><!-- minutes --> <option name="maxSize">100</option> <option name="concurrencyLevel">500</option> </cache> <cache name="MYDIRECTORY-ENTRY-CACHE-WITHOUT-REFERENCES" class="org.nuxeo.ecm.core.redis.contribs.RedisCache"> <option name="maxSize">100</option> <ttl>20</ttl><!-- minutes --> <option name="concurrencyLevel">500</option> </cache> </extension>
Adapt the cache parameters if needed:
name
: The name of the cachettl
: The directory entry life span in the cachemaxSize
: The maximum number of entries in the cache
For each directory that should use the cache, declare the cache in the directory definition using an XML extension.
<extension target="org.nuxeo.ecm.directory.sql.SQLDirectoryFactory" point="directories"> <directory name="MYDIRECTORY"> ... <cacheEntryName>MYDIRECTORY-ENTRY-CACHE</cacheEntryName> <cacheEntryWithoutReferencesName>MYDIRECTORY-ENTRY-CACHE-WITHOUT-REFERENCES</cacheEntryWithoutReferencesName> </directory> </extension>
The example above is about a SQL directory. You should adapt the
target
to the type of directory you're using.
Related How-Tos
Related Documentation