Nuxeo Server

How to Configure a New Directory Cache

Updated: November 13, 2017 Page Information Edit on GitHub

To set up a new cache for your directory, wether for your vocabularies, users or groups:

  1. 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>
      
  2. Adapt the cache parameters if needed:

    • name: The name of the cache
    • ttl: The directory entry life span in the cache
    • maxSize: The maximum number of entries in the cache
  3. 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.


a month ago manonlumeau Added content-review-lts2017 label
2 months ago manonlumeau NXDOC-1346-FT review screenshot
2 years ago Solen Guitter 6
2 years ago Solen Guitter 5
2 years ago Solen Guitter 4
2 years ago Solen Guitter 3
2 years ago Solen Guitter 2
2 years ago Solen Guitter 1
History: Created by Solen Guitter