Search in sources :

Example 1 with MemoryConfigurationBuilder

use of org.infinispan.configuration.cache.MemoryConfigurationBuilder in project wildfly by wildfly.

the class MemoryServiceConfigurator method get.

@Override
public MemoryConfiguration get() {
    EvictionStrategy strategy = this.size > 0 ? EvictionStrategy.REMOVE : EvictionStrategy.MANUAL;
    MemoryConfigurationBuilder builder = new ConfigurationBuilder().memory().storage(this.storageType).whenFull(strategy);
    if (strategy.isEnabled()) {
        if (this.unit == MemorySizeUnit.ENTRIES) {
            builder.maxCount(this.size);
        } else {
            builder.maxSize(Long.toString(this.unit.applyAsLong(this.size)));
        }
    }
    return builder.create();
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) MemoryConfigurationBuilder(org.infinispan.configuration.cache.MemoryConfigurationBuilder) MemoryConfigurationBuilder(org.infinispan.configuration.cache.MemoryConfigurationBuilder) EvictionStrategy(org.infinispan.eviction.EvictionStrategy)

Aggregations

ConfigurationBuilder (org.infinispan.configuration.cache.ConfigurationBuilder)1 MemoryConfigurationBuilder (org.infinispan.configuration.cache.MemoryConfigurationBuilder)1 EvictionStrategy (org.infinispan.eviction.EvictionStrategy)1