private com.atlassian.cache.Cache getCache() { return cacheFactory.getCache(cacheName); }
private com.atlassian.cache.Cache getCache() { return cacheFactory.getCache(cacheName); }
@NotNull private Cache getCache() { return cacheFactory.getCache(cacheName); }
private Cache getCache() { String cacheName = underlyingPropertySetFactory.getClass().getName() + ".propertysets"; return cacheFactory.getCache(cacheName); }
private Cache getUserCache() { synchronized(this) { if (userCacheName == null) userCacheName = getCacheKey(CACHE_SUFFIX_USERS); } return cacheFactory.getCache(userCacheName); }
private Cache getUserROFlagCache() { synchronized(this) { if (userROCacheName == null) userROCacheName = getCacheKey(CACHE_SUFFIX_USERS_RO); } return cacheFactory.getCache(userROCacheName); }
protected Cache<String, Long> makeStatisticsDisabledCache() { final Cache<String, Long> cache = factory.getCache("mycache", null, statsDisabledSettings); assertEmpty(cache); return cache; }
private Cache getRepositoryCache() { synchronized(this) { if (repositoryCacheName == null) repositoryCacheName = getCacheKey(CACHE_SUFFIX_REPOSITORIES); } return cacheFactory.getCache(repositoryCacheName); }
protected Cache<String, Long> makeStatisticsEnabledCache() { final Cache<String, Long> cache = factory.getCache("mycache", null, statsEnabledSettings); assertEmpty(cache); return cache; }
private GenericCacheWrapper<String, List<String>> getCache() { return new GenericCacheWrapper<String, List<String>>( cacheFactory.getCache(cacheName)); }
@Test public void testFactoryGeneratedName() throws Exception { Cache<String, Long> cache = factory.getCache(Object.class, "mycache"); assertThat(cache.getName(), equalTo("java.lang.Object.mycache")); }
@Test public void testFactoryGeneratedName() throws Exception { Cache<String, Long> cache = factory.getCache(Object.class, "mycache"); assertThat(cache.getName(), equalTo("java.lang.Object.mycache")); }
@Test public void testBothExpireHintsSpecified() { CacheSettings required = new CacheSettingsBuilder() .expireAfterAccess(60, TimeUnit.SECONDS) .expireAfterWrite(30, TimeUnit.SECONDS) .build(); Cache<String, String> cache = factory.getCache("fruity", null, required); assertThat(cache, not(nullValue())); } }
public HazelcastAsyncHybridCache(String name, CacheFactory localCacheFactory, ITopic<K> invalidationTopic, final CacheLoader<K, V> cacheLoader, HazelcastCacheManager cacheManager, CacheSettings settings) { super(name, cacheManager); localCache = localCacheFactory.getCache(name, cacheLoader, settings); listener = new AsyncInvalidationListener<K>(cacheManager.getHazelcastInstance().getCluster(), localCache, invalidationTopic); }
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> makeExceptionalCache() { // Build a Cache using the builder CacheLoader<String, Long> loader = new CacheLoader<String, Long>() { @Nonnull @Override public Long load(@Nonnull final String key) { return Long.valueOf(key); } }; final Cache<String, Long> cache = factory.getCache("mycache", loader, settingsBuilder().build()); assertEmpty(cache); return cache; }
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()); }
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; }
protected Cache<String, Long> makeSizeLimitedCache(final int maxEntries, final AtomicInteger loadCounter) { // Build a Cache using the builder CacheLoader<String, Long> loader = new CacheLoader<String, Long>() { @Nonnull @Override public Long load(@Nonnull final String key) { loadCounter.incrementAndGet(); return Long.valueOf(key); } }; CacheSettings settings = settingsBuilder().maxEntries(maxEntries).build(); final Cache<String, Long> cache = factory.getCache("mycache", loader, settings); assertEmpty(cache); return cache; }
private <K, V> Cache<K, V> doCreateCache(String name, CacheLoader<K, V> loader, CacheSettings settings) { if (settings.getLocal(false)) { return localCacheFactory.getCache(name, loader, settings); } if (settings.getReplicateViaCopy(true)) { return createDistributedCache(name, loader, settings); } if (settings.getReplicateAsynchronously(true)) { return createAsyncHybridCache(name, loader, settings); } else { return createHybridCache(name, loader, settings); } }