use of javax.cache.spi.CachingProvider in project spring-boot by spring-projects.
the class JCacheCacheConfiguration method createCacheManager.
private CacheManager createCacheManager() throws IOException {
CachingProvider cachingProvider = getCachingProvider(this.cacheProperties.getJcache().getProvider());
Properties properties = createCacheManagerProperties();
Resource configLocation = this.cacheProperties.resolveConfigLocation(this.cacheProperties.getJcache().getConfig());
if (configLocation != null) {
return cachingProvider.getCacheManager(configLocation.getURI(), cachingProvider.getDefaultClassLoader(), properties);
}
return cachingProvider.getCacheManager(null, null, properties);
}
use of javax.cache.spi.CachingProvider in project caffeine by ben-manes.
the class AbstractJCacheTest method beforeClass.
@BeforeClass(alwaysRun = true)
public void beforeClass() {
CachingProvider provider = Caching.getCachingProvider(CaffeineCachingProvider.class.getName());
cacheManager = provider.getCacheManager(provider.getDefaultURI(), provider.getDefaultClassLoader());
}
use of javax.cache.spi.CachingProvider in project caffeine by ben-manes.
the class CacheManagerTest method beforeClass.
@BeforeClass
public void beforeClass() {
CachingProvider provider = Caching.getCachingProvider(PROVIDER_NAME);
cacheManager = provider.getCacheManager(provider.getDefaultURI(), provider.getDefaultClassLoader());
}
use of javax.cache.spi.CachingProvider in project hazelcast by hazelcast.
the class ClientCacheNearCacheStaleReadTest method setUp.
@Before
public void setUp() throws Exception {
TestHazelcastFactory factory = new TestHazelcastFactory();
valuePut = new AtomicInteger(0);
stop = new AtomicBoolean(false);
failed = new AtomicBoolean(false);
assertionViolationCount = new AtomicInteger(0);
Config config = new Config();
config.setProperty(GroupProperty.CACHE_INVALIDATION_MESSAGE_BATCH_FREQUENCY_SECONDS.getName(), "2");
member = factory.newHazelcastInstance(config);
ClientConfig clientConfig = getClientConfig(CACHE_NAME);
clientConfig.setProperty("hazelcast.invalidation.max.tolerated.miss.count", "0");
client = factory.newHazelcastClient(clientConfig);
CachingProvider provider = HazelcastClientCachingProvider.createCachingProvider(client);
HazelcastClientCacheManager cacheManager = (HazelcastClientCacheManager) provider.getCacheManager();
cache = cacheManager.createCache(CACHE_NAME, createCacheConfig(inMemoryFormat));
}
use of javax.cache.spi.CachingProvider in project hazelcast by hazelcast.
the class ClientCacheRecordStateStressTest method all_records_are_readable_state_in_the_end.
@Test
public void all_records_are_readable_state_in_the_end() throws Exception {
HazelcastInstance member = factory.newHazelcastInstance();
CachingProvider provider = HazelcastServerCachingProvider.createCachingProvider(member);
final CacheManager serverCacheManager = provider.getCacheManager();
factory.newHazelcastInstance();
factory.newHazelcastInstance();
// populated from member.
CacheConfig cacheConfig = new CacheConfig();
cacheConfig.getEvictionConfig().setMaximumSizePolicy(ENTRY_COUNT).setSize(MAX_VALUE);
final Cache memberCache = serverCacheManager.createCache(cacheName, cacheConfig);
for (int i = 0; i < KEY_SPACE; i++) {
memberCache.put(i, i);
}
ClientConfig clientConfig = new ClientConfig();
NearCacheConfig nearCacheConfig = new NearCacheConfig();
nearCacheConfig.setInvalidateOnChange(true).setLocalUpdatePolicy(localUpdatePolicy).getEvictionConfig().setMaximumSizePolicy(ENTRY_COUNT).setSize(MAX_VALUE);
clientConfig.addNearCacheConfig(nearCacheConfig);
List<Thread> threads = new ArrayList<Thread>();
// member
for (int i = 0; i < PUT_THREAD_COUNT; i++) {
Put put = new Put(memberCache);
threads.add(put);
}
// client
HazelcastClientProxy client = (HazelcastClientProxy) factory.newHazelcastClient(clientConfig);
CachingProvider clientCachingProvider = HazelcastClientCachingProvider.createCachingProvider(client);
CacheManager cacheManager = clientCachingProvider.getCacheManager();
final Cache clientCache = cacheManager.createCache(cacheName, cacheConfig);
for (int i = 0; i < GET_ALL_THREAD_COUNT; i++) {
GetAll getAll = new GetAll(clientCache);
threads.add(getAll);
}
for (int i = 0; i < PUT_ALL_THREAD_COUNT; i++) {
PutAll putAll = new PutAll(clientCache);
threads.add(putAll);
}
for (int i = 0; i < PUT_IF_ABSENT_THREAD_COUNT; i++) {
PutIfAbsent putIfAbsent = new PutIfAbsent(clientCache);
threads.add(putIfAbsent);
}
for (int i = 0; i < GET_THREAD_COUNT; i++) {
Get get = new Get(clientCache);
threads.add(get);
}
for (int i = 0; i < REMOVE_THREAD_COUNT; i++) {
Remove remove = new Remove(clientCache);
threads.add(remove);
}
for (int i = 0; i < CLEAR_THREAD_COUNT; i++) {
Clear clear = new Clear(clientCache);
threads.add(clear);
}
// start threads
for (Thread thread : threads) {
thread.start();
}
// stress for a while
sleepSeconds(TEST_RUN_SECONDS);
// stop threads
stop.set(true);
for (Thread thread : threads) {
thread.join();
}
assertFinalRecordStateIsReadPermitted(clientCache, member);
}
Aggregations