protected Cache<String, Long> makeSizeLimitedCache(int maxEntries) { CacheSettings required = settingsBuilder().maxEntries(maxEntries).build(); final Cache<String, Long> cache = factory.getCache("mycache", null, required); assertEmpty(cache); return cache; }
public ClusterLogScanCache(CacheManager cacheManager) { lastScan = cacheManager.getCache("com.atlassian.stp.lastLogScan", null, new CacheSettingsBuilder() .expireAfterWrite(CACHE_EXPIRY_DURATION_MS, TimeUnit.MILLISECONDS) .local() .build()); }
public ClusterMonitoredTaskExecutor(CacheFactory cacheFactory, String name, int maxThreads) { super(name, maxThreads); clusterMonitors = cacheFactory.getCache(TASK_MONITOR_PREFIX + name, null, new CacheSettingsBuilder() // entries should be removed when the local monitor expires, but let's be paranoid .expireAfterWrite(2, TimeUnit.HOURS) .remote() .build()); }
private CachedReference<Long> makeNullReference() { return factory.getCachedReference("mycache", nullSupplier(), settingsBuilder().build()); }
protected CachedReference<Long> makeReference() { // Build a Cache using the builder Supplier<Long> supplier = new Supplier<Long>() { private long value = 100; @Override public Long get() { return value++; } }; return factory.getCachedReference("mycache", supplier, settingsBuilder().build()); }
@Override public ClassMap put(final Class clazz) { return classMapCache.get(clazz); }
@Override public void clear() { classMapCache.removeAll(); }
protected Cache<String, Long> makeStatisticsEnabledCache() { final Cache<String, Long> cache = factory.getCache("mycache", null, statsEnabledSettings); assertEmpty(cache); return cache; }
protected CacheSettings mergeSettings(String name, CacheSettings settings) { if (cacheSettingsDefaultsProvider == null) { return settings; } return cacheSettingsDefaultsProvider.getDefaults(name).override(settings); }
/** * Sets the duration formatter with a new instance of a particular formatter chosen based on the settings in the * application properties and authentication context * * @param applicationProperties application properties * @param authenticationContext authentication context */ public void updateFormatters(ApplicationProperties applicationProperties, JiraAuthenticationContext authenticationContext) { formatterRef.reset(); }
protected Cache<String, Long> makeSimpleCache(boolean statsEnabled) { // Build a Cache using the builder final Cache<String, Long> cache = factory.getCache("mycache", null, settingsBuilder(statsEnabled).build()); assertEmpty(cache); return cache; }
protected Cache<String, Long> makeStatisticsDisabledCache() { final Cache<String, Long> cache = factory.getCache("mycache", null, statsDisabledSettings); assertEmpty(cache); return cache; }
@Override public void refresh() { cache.removeAll(); }