Search in sources :

Example 6 with IElementAttributes

use of org.apache.jcs.engine.behavior.IElementAttributes in project nhin-d by DirectProject.

the class LDAPCertificateStore method applyCachePolicy.

private void applyCachePolicy(CertStoreCachePolicy policy) {
    if (getCache() != null) {
        try {
            ICompositeCacheAttributes attributes = cache.getCacheAttributes();
            attributes.setMaxObjects(policy.getMaxItems());
            attributes.setUseLateral(false);
            attributes.setUseRemote(false);
            cache.setCacheAttributes(attributes);
            IElementAttributes eattributes = cache.getDefaultElementAttributes();
            eattributes.setMaxLifeSeconds(policy.getSubjectTTL());
            eattributes.setIsEternal(false);
            eattributes.setIsLateral(false);
            eattributes.setIsRemote(false);
            cache.setDefaultElementAttributes(eattributes);
        } catch (CacheException e) {
        // TODO: Handle exception
        }
    }
}
Also used : CacheException(org.apache.jcs.access.exception.CacheException) ICompositeCacheAttributes(org.apache.jcs.engine.behavior.ICompositeCacheAttributes) IElementAttributes(org.apache.jcs.engine.behavior.IElementAttributes)

Aggregations

ICompositeCacheAttributes (org.apache.jcs.engine.behavior.ICompositeCacheAttributes)6 IElementAttributes (org.apache.jcs.engine.behavior.IElementAttributes)6 CacheException (org.apache.jcs.access.exception.CacheException)5