org.infinispan.eviction.EvictionType Java Examples
The following examples show how to use
org.infinispan.eviction.EvictionType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InfinispanKeyStorageProviderTest.java From keycloak with Apache License 2.0 | 6 votes |
protected Cache<String, PublicKeysEntry> getKeysCache() { GlobalConfigurationBuilder gcb = new GlobalConfigurationBuilder(); gcb.globalJmxStatistics().allowDuplicateDomains(true).enabled(true); final DefaultCacheManager cacheManager = new DefaultCacheManager(gcb.build()); ConfigurationBuilder cb = new ConfigurationBuilder(); cb.memory() .evictionStrategy(EvictionStrategy.REMOVE) .evictionType(EvictionType.COUNT) .size(InfinispanConnectionProvider.KEYS_CACHE_DEFAULT_MAX); cb.jmxStatistics().enabled(true); Configuration cfg = cb.build(); cacheManager.defineConfiguration(InfinispanConnectionProvider.KEYS_CACHE_NAME, cfg); return cacheManager.getCache(InfinispanConnectionProvider.KEYS_CACHE_NAME); }
Example #2
Source File: InfinispanCacheTestConfiguration.java From infinispan-spring-boot with Apache License 2.0 | 6 votes |
@Bean public InfinispanCacheConfigurer cacheConfigurer() { return cacheManager -> { final org.infinispan.configuration.cache.ConfigurationBuilder testCacheBuilder = new ConfigurationBuilder(); testCacheBuilder.simpleCache(true) .memory() .storageType(StorageType.OBJECT) .evictionType(EvictionType.COUNT) .evictionStrategy(EvictionStrategy.MANUAL); testCacheBuilder.statistics().enable(); cacheManager.defineConfiguration(TEST_CACHE_NAME, testCacheBuilder.build()); }; }
Example #3
Source File: DefaultInfinispanConnectionProviderFactory.java From keycloak with Apache License 2.0 | 6 votes |
private Configuration getRevisionCacheConfig(long maxEntries) { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.invocationBatching().enable().transaction().transactionMode(TransactionMode.TRANSACTIONAL); // Use Embedded manager even in managed ( wildfly/eap ) environment. We don't want infinispan to participate in global transaction cb.transaction().transactionManagerLookup(new EmbeddedTransactionManagerLookup()); cb.transaction().lockingMode(LockingMode.PESSIMISTIC); cb.memory() .evictionStrategy(EvictionStrategy.REMOVE) .evictionType(EvictionType.COUNT) .size(maxEntries); return cb.build(); }
Example #4
Source File: ClusterManager.java From glowroot with Apache License 2.0 | 6 votes |
private static Configuration createCacheConfiguration(int size) { ConfigurationBuilder configurationBuilder = new ConfigurationBuilder(); // "max idle" is to keep memory down for deployments with few agents // "size" is to keep memory bounded for deployments with lots of agents configurationBuilder.clustering() .cacheMode(CacheMode.INVALIDATION_ASYNC) .expiration() .maxIdle(30, MINUTES) .memory() .size(size) .evictionType(EvictionType.COUNT) .evictionStrategy(EvictionStrategy.REMOVE) .jmxStatistics() .enable(); return configurationBuilder.build(); }
Example #5
Source File: InfinispanEmbeddedAutoConfigurationCustomizerIntegrationTest.java From infinispan-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "small-cache") public org.infinispan.configuration.cache.Configuration smallCache() { return new ConfigurationBuilder() .simpleCache(true) .memory().size(1000L) .memory().evictionType(EvictionType.COUNT) .build(); }
Example #6
Source File: DefaultInfinispanConnectionProviderFactory.java From keycloak with Apache License 2.0 | 5 votes |
private ConfigurationBuilder getActionTokenCacheConfig() { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.memory() .evictionStrategy(EvictionStrategy.NONE) .evictionType(EvictionType.COUNT) .size(InfinispanConnectionProvider.ACTION_TOKEN_CACHE_DEFAULT_MAX); cb.expiration() .maxIdle(InfinispanConnectionProvider.ACTION_TOKEN_MAX_IDLE_SECONDS, TimeUnit.SECONDS) .wakeUpInterval(InfinispanConnectionProvider.ACTION_TOKEN_WAKE_UP_INTERVAL_SECONDS, TimeUnit.SECONDS); return cb; }
Example #7
Source File: DefaultInfinispanConnectionProviderFactory.java From keycloak with Apache License 2.0 | 5 votes |
protected Configuration getKeysCacheConfig() { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.memory() .evictionStrategy(EvictionStrategy.REMOVE) .evictionType(EvictionType.COUNT) .size(InfinispanConnectionProvider.KEYS_CACHE_DEFAULT_MAX); cb.expiration().maxIdle(InfinispanConnectionProvider.KEYS_CACHE_MAX_IDLE_SECONDS, TimeUnit.SECONDS); return cb.build(); }
Example #8
Source File: InfinispanServerClusterConfiguration.java From spring-batch-lightmin with Apache License 2.0 | 5 votes |
protected org.infinispan.configuration.cache.Configuration getConfiguration(final Long limit) { return new ConfigurationBuilder() .clustering() .cacheMode(CacheMode.REPL_SYNC) .stateTransfer() .awaitInitialTransfer(Boolean.FALSE) .jmxStatistics() .enable() .eviction() .type(EvictionType.COUNT) .size(limit) .build(); }
Example #9
Source File: InfinispanEmbeddedAutoConfigurationCustomizerIntegrationTest.java From infinispan-spring-boot with Apache License 2.0 | 5 votes |
@Test public void testConfiguration() { assertThat(manager.getCacheManagerConfiguration().transport().clusterName()).isEqualTo(CLUSTER_NAME); assertThat(manager.getDefaultCacheConfiguration()).isNull(); assertThat(manager.getCacheNames()).contains("small-cache"); assertThat(manager.getCacheConfiguration("small-cache").memory().size()).isEqualTo(1000L); assertThat(manager.getCacheConfiguration("small-cache").memory().evictionType()).isEqualTo(EvictionType.COUNT); assertThat(startedEvent).isNotNull(); }
Example #10
Source File: InfinispanEmbeddedAutoConfigurationIntegrationConfigurerTest.java From infinispan-spring-boot with Apache License 2.0 | 5 votes |
@Test public void testWithCacheConfigurer() { assertThat(defaultCacheManager.getCacheNames()).containsExactlyInAnyOrder(InfinispanCacheTestConfiguration.TEST_CACHE_NAME, "default"); final Configuration testCacheConfiguration = defaultCacheManager.getCacheConfiguration(InfinispanCacheTestConfiguration.TEST_CACHE_NAME); assertThat(testCacheConfiguration.statistics().enabled()).isTrue(); assertThat(testCacheConfiguration.memory().storageType()).isEqualTo(StorageType.OBJECT); assertThat(testCacheConfiguration.memory().evictionType()).isEqualTo(EvictionType.COUNT); assertThat(testCacheConfiguration.memory().evictionStrategy()).isEqualTo(EvictionStrategy.MANUAL); }
Example #11
Source File: InfinispanCacheConfigurationTestConfiguration.java From infinispan-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "large-cache") public org.infinispan.configuration.cache.Configuration largeCache() { return new ConfigurationBuilder() .read(baseCache) .memory().size(2000L) .memory().evictionType(EvictionType.COUNT) .build(); }
Example #12
Source File: InfinispanCacheConfigurationTestConfiguration.java From infinispan-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "small-cache") public org.infinispan.configuration.cache.Configuration smallCache() { return new ConfigurationBuilder() .read(baseCache) .memory().size(1000L) .memory().evictionType(EvictionType.COUNT) .build(); }
Example #13
Source File: InfinispanCacheConfigurationBaseTestConfiguration.java From infinispan-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "base-cache") public org.infinispan.configuration.cache.Configuration smallCache() { return new ConfigurationBuilder() .simpleCache(true) .memory().size(500L) .memory().evictionType(EvictionType.COUNT) .build(); }
Example #14
Source File: InfinispanEmbeddedAutoConfigurationIntegrationConfigurationTest.java From infinispan-spring-boot with Apache License 2.0 | 5 votes |
@Test public void testConfiguration() { assertThat(manager.getCacheNames()).contains("base-cache", "small-cache", "large-cache"); assertThat(manager.getCacheConfiguration("base-cache").memory().size()).isEqualTo(500L); assertThat(manager.getCacheConfiguration("base-cache").memory().evictionType()).isEqualTo(EvictionType.COUNT); assertThat(manager.getCacheConfiguration("small-cache").memory().size()).isEqualTo(1000L); assertThat(manager.getCacheConfiguration("small-cache").memory().evictionType()).isEqualTo(EvictionType.COUNT); assertThat(manager.getCacheConfiguration("large-cache").memory().size()).isEqualTo(2000L); assertThat(manager.getCacheConfiguration("large-cache").memory().evictionType()).isEqualTo(EvictionType.COUNT); }
Example #15
Source File: TestPersistence.java From hacep with Apache License 2.0 | 5 votes |
@Override public ConfigurationBuilder extendDefaultConfiguration(ConfigurationBuilder builder) { SingleFileStoreConfigurationBuilder sfcb = builder .persistence() .passivation(false) .addSingleFileStore() .shared(false) .preload(true) .fetchPersistentState(true) .purgeOnStartup(false); if( nodeSelector == 1 ){ sfcb.location(persistenceLocation); } else if( nodeSelector == 2) { sfcb.location(persistenceLocation2); } else if( nodeSelector == 3) { sfcb.location(persistenceLocation3); } else { throw new UnsupportedOperationException("Node id unknown"); } sfcb.singleton().enabled(false) .eviction() .strategy(EvictionStrategy.LRU).type(EvictionType.COUNT).size(1024); return builder; }
Example #16
Source File: DataGridManager.java From hacep with Apache License 2.0 | 4 votes |
public void start(HAKieSessionBuilder builder, String nodeName) { if (started.compareAndSet(false, true)) { GlobalConfiguration globalConfiguration = new GlobalConfigurationBuilder().clusteredDefault() .transport().addProperty("configurationFile", System.getProperty("jgroups.configuration", "jgroups-tcp.xml")) .clusterName("HACEP").nodeName(nodeName) .globalJmxStatistics().allowDuplicateDomains(true).enable() .serialization() .addAdvancedExternalizer(new HAKieSession.HASessionExternalizer(builder)) .addAdvancedExternalizer(new HAKieSerializedSession.HASerializedSessionExternalizer(builder)) .addAdvancedExternalizer(new HAKieSessionDeltaEmpty.HASessionDeltaEmptyExternalizer(builder)) .addAdvancedExternalizer(new HAKieSessionDeltaFact.HASessionDeltaFactExternalizer(builder)) .build(); ConfigurationBuilder commonConfigurationBuilder = new ConfigurationBuilder(); CacheMode cacheMode = getCacheMode(); if (cacheMode.isDistributed()) { commonConfigurationBuilder .clustering().cacheMode(cacheMode) .hash().numOwners(getNumOwners()) .groups().enabled(); } else { commonConfigurationBuilder.clustering().cacheMode(cacheMode); } Configuration commonConfiguration = commonConfigurationBuilder.build(); this.manager = new DefaultCacheManager(globalConfiguration, commonConfiguration, false); ConfigurationBuilder factCacheConfigurationBuilder = new ConfigurationBuilder().read(commonConfiguration); factCacheConfigurationBuilder .expiration() .maxIdle(factsExpiration(), TimeUnit.MILLISECONDS); ConfigurationBuilder sessionCacheConfigurationBuilder = new ConfigurationBuilder().read(commonConfiguration); if (persistence()) { sessionCacheConfigurationBuilder .persistence() .passivation(isPassivated()) .addSingleFileStore() .shared(shared()) .preload(preload()) .fetchPersistentState(fetchPersistentState()) .purgeOnStartup(purgeOnStartup()) .location(location()) .async().threadPoolSize(threadPoolSize()).enabled(false) .singleton().enabled(false) .eviction() .strategy(EvictionStrategy.LRU).type(EvictionType.COUNT).size(evictionSize()); } this.manager.defineConfiguration(FACT_CACHE_NAME, factCacheConfigurationBuilder.build()); this.manager.defineConfiguration(SESSION_CACHE_NAME, sessionCacheConfigurationBuilder.build()); this.manager.start(); } }
Example #17
Source File: InfinispanEmbeddedAutoConfigurationCustomizerIntegrationTest.java From infinispan-spring-boot with Apache License 2.0 | 4 votes |
@Bean public InfinispanConfigurationCustomizer configurationCustomizer() { return builder -> { builder.memory().evictionType(EvictionType.COUNT); }; }
Example #18
Source File: CacheConfiguration.java From tutorials with MIT License | 4 votes |
private Configuration evictingConfiguration() { return new ConfigurationBuilder().memory().evictionType(EvictionType.COUNT).size(1).build(); }
Example #19
Source File: CacheConfiguration.java From tutorials with MIT License | 4 votes |
private Configuration passivatingConfiguration() { return new ConfigurationBuilder().memory().evictionType(EvictionType.COUNT).size(1).persistence().passivation(true).addSingleFileStore().purgeOnStartup(true).location(System.getProperty("java.io.tmpdir")).build(); }