private CacheConfiguration tweakCacheConfiguration(CacheConfiguration cacheConfiguration) { // Set searchable index Searchable uidToDocumentCacheSearchable = new Searchable(); uidToDocumentCacheSearchable.addSearchAttribute(new SearchAttribute().name("ObjectId") .expression("value.getObjectId().toString()")); uidToDocumentCacheSearchable.addSearchAttribute(new SearchAttribute().name("VersionFromInstant") .className("com.opengamma.master.cache.InstantExtractor")); uidToDocumentCacheSearchable.addSearchAttribute(new SearchAttribute().name("VersionToInstant") .className("com.opengamma.master.cache.InstantExtractor")); uidToDocumentCacheSearchable.addSearchAttribute(new SearchAttribute().name("CorrectionFromInstant") .className("com.opengamma.master.cache.InstantExtractor")); uidToDocumentCacheSearchable.addSearchAttribute(new SearchAttribute().name("CorrectionToInstant") .className("com.opengamma.master.cache.InstantExtractor")); cacheConfiguration.addSearchable(uidToDocumentCacheSearchable); // Make copies of cached objects CopyStrategyConfiguration copyStrategyConfiguration = new CopyStrategyConfiguration(); copyStrategyConfiguration.setClass("com.opengamma.master.cache.JodaBeanCopyStrategy"); cacheConfiguration.addCopyStrategy(copyStrategyConfiguration); cacheConfiguration.setCopyOnRead(true); cacheConfiguration.setCopyOnWrite(true); cacheConfiguration.setStatistics(true); return cacheConfiguration; }
private Cache createAclCache(CacheId cacheId) { // configure cache as searchable CacheConfiguration cacheConfig = new CacheConfiguration(cacheId.getIdAsString(), 0).eternal(true); Searchable searchable = new Searchable(); cacheConfig.addSearchable(searchable); // register searchable attributes searchable.addSearchAttribute(new SearchAttribute().name(UserDomainInterfaceOperationKey.USER_ID)); searchable.addSearchAttribute(new SearchAttribute().name(UserDomainInterfaceOperationKey.DOMAIN)); searchable.addSearchAttribute(new SearchAttribute().name(UserDomainInterfaceOperationKey.INTERFACE)); searchable.addSearchAttribute(new SearchAttribute().name(UserDomainInterfaceOperationKey.OPERATION)); cacheManager.addCache(new Cache(cacheConfig)); return cacheManager.getCache(cacheId.getIdAsString()); }
private Cache createDrtCache() { // configure cache as searchable CacheConfiguration cacheConfig = new CacheConfiguration(CacheId.DOMAIN_ROLES.getIdAsString(), 0).eternal(true); Searchable searchable = new Searchable(); cacheConfig.addSearchable(searchable); // register searchable attributes searchable.addSearchAttribute(new SearchAttribute().name(UserRoleKey.USER_ID)); searchable.addSearchAttribute(new SearchAttribute().name(UserRoleKey.ROLE)); cacheManager.addCache(new Cache(cacheConfig)); return cacheManager.getCache(CacheId.DOMAIN_ROLES.getIdAsString()); }
@Nullable public Searchable getSearchable() { return this.searchable; }
public void setSearchable(@Nullable Searchable searchable) { this.searchable = searchable; }