CachingUserHistoryStore(@Nonnull final OfBizUserHistoryStore delegatingStore, @Nonnull final ApplicationProperties applicationProperties, final CacheManager cacheManager, int maxThreshold) { this.delegatingStore = notNull("delegatingStore", delegatingStore); this.applicationProperties = notNull("applicationProperties", applicationProperties); this.maxThreshold = maxThreshold; this.cache = cacheManager.getCache(CachingUserHistoryStore.class.getName() + ".cache", new DelegatingStoreCacheLoader(), new CacheSettingsBuilder().local().expireAfterAccess(15, TimeUnit.MINUTES).build()); }
public ClusterLogScanCache(CacheManager cacheManager) { lastScan = cacheManager.getCache("com.atlassian.stp.lastLogScan", null, new CacheSettingsBuilder() .expireAfterWrite(CACHE_EXPIRY_DURATION_MS, TimeUnit.MILLISECONDS) .local() .build()); }
@Autowired public DefaultRemoteCapabilitiesService(ApplicationLinkService applicationLinkService, ApplinkHelper applinkHelper, ApplinksRequestCache applinksRequestCache, EventPublisher eventPublisher, AppLinksManifestDownloader manifestDownloader, PermissionValidationService permissionValidationService, ServiceExceptionFactory serviceExceptionFactory, CacheFactory cacheFactory) { this.applicationLinkService = applicationLinkService; this.applinkHelper = applinkHelper; this.applinksRequestCache = applinksRequestCache; this.eventPublisher = eventPublisher; this.manifestDownloader = manifestDownloader; this.permissionValidationService = permissionValidationService; this.serviceExceptionFactory = serviceExceptionFactory; this.capabilitiesCache = cacheFactory.getCache("applinks.capabilities", null, new CacheSettingsBuilder() .local() .maxEntries(MAX_CACHE_SIZE) .build()); }
public EventSerializer(final AnalyticsPropertyService applicationProperties, final PropertyExtractor propertyExtractor, final SenProvider senProvider, final CacheManager cacheManager, final AnalyticsEmailHasher analyticsEmailHasher) { this.applicationProperties = applicationProperties; this.product = applicationProperties.getDisplayName().toLowerCase(); this.version = applicationProperties.getVersion(); this.propertyExtractor = propertyExtractor; this.senProvider = senProvider; this.emailHashCache = cacheManager.getCache(EventSerializer.class.getName() + ".emailHash", new CacheLoader<Optional<String>, Optional<String>>() { @Override public Optional<String> load(Optional<String> email) { return email.isPresent() ? fromNullable(analyticsEmailHasher.hash(email.get())) : Optional.<String>absent(); } }, new CacheSettingsBuilder() .local() .expireAfterAccess(2, TimeUnit.HOURS).build()); }
protected CacheSettingsBuilder settingsBuilder(boolean statsEnabled) { final CacheSettingsBuilder bob = new CacheSettingsBuilder(); if (statsEnabled) { bob.statisticsEnabled(); } else { bob.statisticsDisabled(); } if (cacheType == CacheType.LOCAL) { bob.local(); } else if (cacheType == CacheType.REMOTE) { bob.remote(); } else if (cacheType == CacheType.HYBRID) { bob.remote().replicateViaInvalidation(); } return bob; }