public OfBizInternalMembershipDao(final OfBizDelegator ofBizDelegator, final CacheManager cacheManager) { this.ofBizDelegator = ofBizDelegator; parentsCache = cacheManager.getCache(OfBizInternalMembershipDao.class.getName() + ".parentsCache", new ParentsLoader(), new CacheSettingsBuilder().expireAfterAccess(30, TimeUnit.MINUTES).flushable().build()); childrenCache = cacheManager.getCache(OfBizInternalMembershipDao.class.getName() + ".childrenCache", new ChildrenLoader(), new CacheSettingsBuilder().expireAfterAccess(30, TimeUnit.MINUTES).flushable().build()); }
public LazyOfBizGroupCache(final CacheManager cacheManager, final OfBizDelegator ofBizDelegator) { this.ofBizDelegator = ofBizDelegator; this.cache = cacheManager.getCache(LazyOfBizGroupCache.class.getName() + ".groupCache", new GroupCacheLoader(), new CacheSettingsBuilder().expireAfterAccess(30, TimeUnit.MINUTES).flushable() .build()); }
protected <V> CachedReference<V> createDistributedCachedReference(String name, Supplier<V> supplier, CacheSettings settings) { // override the settings to ensure the reference is flushable and the max is set to 1000. A low value for // maxEntries would trigger continuous cache invalidations because of the way map eviction works in Hazelcast. final CacheSettings overriddenSettings = checkNotNull(settings, "settings").override( new CacheSettingsBuilder().flushable().maxEntries(1000).build()); final String mapName = PREFIX_CACHE_REFERENCE + name; configureMap(mapName, overriddenSettings); final IMap<String, OsgiSafe<V>> map = hazelcast.getMap(mapName); return new HazelcastCachedReference<V>(name, map, supplier, this); }
public LazyOfBizUserCache(final CacheManager cacheManager, final OfBizDelegator ofBizDelegator) { this.ofBizDelegator = ofBizDelegator; this.cache = cacheManager.getCache(LazyOfBizUserCache.class.getName() + ".userCache", new UserCacheLoader(), new CacheSettingsBuilder() .expireAfterAccess(30, TimeUnit.MINUTES).flushable().build()); }
@Nonnull @SuppressWarnings("unchecked") @Override public <V> CachedReference<V> getCachedReference(@Nonnull final String name, @Nonnull final com.atlassian.cache.Supplier<V> supplier, @Nonnull final CacheSettings settings) { // Force the cache settings to be flushable and a maximum size of one. final CacheSettings overridenSettings = settings.override( new CacheSettingsBuilder().flushable().maxEntries(1).build()); return cacheCreationLocks.get(name).withLock(new com.atlassian.util.concurrent.Supplier<DelegatingCachedReference<V>>() { @Override public DelegatingCachedReference<V> get() { final Ehcache spCache = getLoadingCache(name, overridenSettings, new ValueProcessorAtlassianCacheLoaderDecorator(new SupplierAdapter<>(supplier), valueProcessor)); final DelegatingCachedReference<V> cache = DelegatingCachedReference.create(spCache, overridenSettings, valueProcessor); caches.put(name, new WeakSupplier<ManagedCache>(cache)); return cache; } }); }
settings.override(new CacheSettingsBuilder().flushable().build()));
/** * Creates a new CachingFieldConfigContextPersister that wraps a new FieldConfigContextPersisterImpl instance. * * @param delegator the OfBizDelegator * @param projectManager the ProjectManager */ @SuppressWarnings ("UnusedDeclaration") public CachingFieldConfigContextPersister(OfBizDelegator delegator, ProjectManager projectManager, CacheManager cacheManager) { this.ofBizDelegator = delegator; this.worker = new FieldConfigContextPersisterWorker(delegator, projectManager, cacheManager); fieldContextCache = cacheManager.getCache(CachingFieldConfigContextPersister.class.getName() + ".fieldContextCache", new FieldConfigContextCacheLoader(), new CacheSettingsBuilder().expireAfterAccess(30, TimeUnit.MINUTES).flushable().build()); configSchemeIssueTypeCache = cacheManager.getCache(CachingFieldConfigContextPersister.class.getName() + ".configSchemeIssueTypeCache", new ConfigSchemeIssueTypeCacheLoader(), new CacheSettingsBuilder().expireAfterAccess(30, TimeUnit.MINUTES).flushable().build()); }
public OfBizUserDao(final OfBizDelegator ofBizDelegator, final DirectoryDao directoryDao, final InternalMembershipDao membershipDao, final UserKeyStore userKeyStore, final UserDeleteVeto userDeleteVeto, final CacheManager cacheManager, final ClusterLockService clusterLockService, final ApplicationProperties applicationProperties) { this.ofBizDelegator = ofBizDelegator; this.directoryDao = directoryDao; this.membershipDao = membershipDao; this.userKeyStore = userKeyStore; this.userDeleteVeto = userDeleteVeto; this.applicationProperties = applicationProperties; this.userAttributesCache = cacheManager.getCache(OfBizUserDao.class.getName() + ".userAttributesCache", new UserAttributesCacheLoader(), new CacheSettingsBuilder().expireAfterAccess(30, TimeUnit.MINUTES).flushable().build()); if (useFullCache()) { log.info("Using full user cache"); this.userCaseInsensitiveCache = new EagerOfBizUserCache(clusterLockService, cacheManager, directoryDao, ofBizDelegator); } else { log.info("Using lazy user cache"); this.userCaseInsensitiveCache = new LazyOfBizUserCache(cacheManager, ofBizDelegator); } }