Skip to content

Commit

Permalink
Prepare for next release
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-manes committed Feb 19, 2016
1 parent 610d90e commit d52a688
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 45 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ subprojects {
group = 'com.github.ben-manes.caffeine'
version.with {
major = 2 // incompatible API changes
minor = 1 // backwards-compatible additions
patch = 1 // backwards-compatible bug fixes
minor = 2 // backwards-compatible additions
patch = 0 // backwards-compatible bug fixes
releaseBuild = rootProject.hasProperty('release')
}
archivesBaseName = path[1..-1].replaceAll(':', '-').toLowerCase()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.cache2k.impl.ClockProPlusCache;
import org.cache2k.impl.LruCache;
import org.cliffc.high_scale_lib.NonBlockingHashMap;
import org.ehcache.config.Eviction.Prioritizer;
import org.infinispan.commons.equivalence.AnyEquivalence;
import org.infinispan.commons.util.concurrent.jdk8backported.BoundedEquivalentConcurrentHashMapV8;
import org.infinispan.commons.util.concurrent.jdk8backported.BoundedEquivalentConcurrentHashMapV8.Eviction;
Expand Down Expand Up @@ -100,9 +99,9 @@ public enum CacheType {
return new Ehcache2<>(MemoryStoreEvictionPolicy.LRU, maximumSize);
}
},
Ehcache3_Lru {
Ehcache3 {
@Override public <K, V> BasicCache<K, V> create(int maximumSize) {
return new Ehcache3<>(Prioritizer.LRU, maximumSize);
return new Ehcache3<>(maximumSize);
}
},
Guava {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class EvictionBenchmark {
"LinkedHashMap_Lru",
"Caffeine",
"Ehcache2_Lru",
"Ehcache3_Lru",
"Ehcache3",
})
CacheType cacheType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class GetPutBenchmark {
"Cache2k_ClockProPlus",
"Cache2k_Lru",
"Ehcache2_Lru",
"Ehcache3_Lru",
"Ehcache3",
"Infinispan_Old_Lru",
"Infinispan_New_Lru",
"TCache_Lfu",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@

import org.ehcache.Cache;
import org.ehcache.CacheManager;
import org.ehcache.CacheManagerBuilder;
import org.ehcache.config.CacheConfigurationBuilder;
import org.ehcache.config.Eviction.Prioritizer;
import org.ehcache.config.ResourcePoolsBuilder;
import org.ehcache.config.builders.CacheConfigurationBuilder;
import org.ehcache.config.builders.CacheManagerBuilder;
import org.ehcache.config.builders.ResourcePoolsBuilder;
import org.ehcache.config.units.EntryUnit;

import com.github.benmanes.caffeine.cache.BasicCache;
Expand All @@ -32,15 +31,14 @@ public final class Ehcache3<K, V> implements BasicCache<K, V> {
private final Cache<K, V> cache;

@SuppressWarnings("unchecked")
public Ehcache3(Prioritizer evictionPolicy, int maximumSize) {
public Ehcache3(int maximumSize) {
CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder().build(true);
cache = (Cache<K, V>) cacheManager.createCache("benchmark",
CacheConfigurationBuilder.newCacheConfigurationBuilder()
CacheConfigurationBuilder.newCacheConfigurationBuilder(Object.class, Object.class)
.withResourcePools(ResourcePoolsBuilder.newResourcePoolsBuilder()
.heap(maximumSize, EntryUnit.ENTRIES)
.build())
.usingEvictionPrioritizer(evictionPolicy)
.buildConfig(Object.class, Object.class));
.build());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ public <K1 extends K, V1 extends V> LoadingCache<K1, V1> build(

/**
* Builds a cache, which either returns a {@link CompletableFuture} already loaded or currently
* computing the value for a given key or atomically computes the value asynchronously through a
* computing the value for a given key, or atomically computes the value asynchronously through a
* supplied mapping function or the supplied {@code CacheLoader}. If the asynchronous computation
* fails or computes a {@code null} value then the entry will be automatically removed. Note that
* multiple threads can concurrently load values for distinct keys.
Expand All @@ -855,7 +855,7 @@ public <K1 extends K, V1 extends V> AsyncLoadingCache<K1, V1> buildAsync(

/**
* Builds a cache, which either returns a {@link CompletableFuture} already loaded or currently
* computing the value for a given key or atomically computes the value asynchronously through a
* computing the value for a given key, or atomically computes the value asynchronously through a
* supplied mapping function or the supplied {@code AsyncCacheLoader}. If the asynchronous
* computation fails or computes a {@code null} value then the entry will be automatically
* removed. Note that multiple threads can concurrently load values for distinct keys.
Expand Down Expand Up @@ -885,11 +885,11 @@ public <K1 extends K, V1 extends V> AsyncLoadingCache<K1, V1> buildAsync(
: new UnboundedLocalCache.UnboundedLocalAsyncLoadingCache<K1, V1>(self, loader);
}

private void requireNonLoadingCache() {
void requireNonLoadingCache() {
requireState(refreshNanos == UNSET_INT, "refreshAfterWrite requires a LoadingCache");
}

private void requireWeightWithWeigher() {
void requireWeightWithWeigher() {
if (weigher == null) {
requireState(maximumWeight == UNSET_INT, "maximumWeight requires weigher");
} else if (strictParsing) {
Expand Down
6 changes: 3 additions & 3 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ ext {
cache2k: '0.23',
concurrentlinkedhashmap: '1.4.2',
ehcache2: '2.10.1-55',
ehcache3: '3.0.0.m4',
ehcache3: '3.0.0.m5',
high_scale_lib: '1.0.6',
infinispan: '8.2.0.Beta2',
jackrabbit: '1.3.15',
jackrabbit: '1.3.16',
jamm: '0.3.1',
java_object_layout: '0.4',
koloboke: '0.6.8',
Expand All @@ -70,7 +70,7 @@ ext {
coveralls: '2.6.3',
extra_conf: '3.0.3',
error_prone: '0.0.8',
jacoco: '0.7.5.201505241946',
jacoco: '0.7.6.201602180812',
jmh: '0.2.0',
nexus: '2.3.1',
versions: '0.12.0',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@

import org.ehcache.Cache;
import org.ehcache.CacheManager;
import org.ehcache.CacheManagerBuilder;
import org.ehcache.config.CacheConfigurationBuilder;
import org.ehcache.config.Eviction.Prioritizer;
import org.ehcache.config.EvictionPrioritizer;
import org.ehcache.config.ResourcePoolsBuilder;
import org.ehcache.config.builders.CacheConfigurationBuilder;
import org.ehcache.config.builders.CacheManagerBuilder;
import org.ehcache.config.builders.ResourcePoolsBuilder;
import org.ehcache.config.units.EntryUnit;

import com.github.benmanes.caffeine.cache.simulator.BasicSettings;
Expand All @@ -45,15 +43,14 @@ public final class Ehcache3Policy implements Policy {

public Ehcache3Policy(Config config) {
policyStats = new PolicyStats("product.Ehcache3");
Ehcache3Settings settings = new Ehcache3Settings(config);
BasicSettings settings = new BasicSettings(config);
CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder().build(true);
cache = cacheManager.createCache("ehcache3",
CacheConfigurationBuilder.newCacheConfigurationBuilder()
CacheConfigurationBuilder.newCacheConfigurationBuilder(Object.class, Object.class)
.withResourcePools(ResourcePoolsBuilder.newResourcePoolsBuilder()
.heap(settings.maximumSize(), EntryUnit.ENTRIES)
.build())
.usingEvictionPrioritizer(settings.prioritizer())
.buildConfig(Object.class, Object.class));
.build());
maximumSize = settings.maximumSize();
}

Expand Down Expand Up @@ -81,13 +78,4 @@ public void record(long key) {
public PolicyStats stats() {
return policyStats;
}

static final class Ehcache3Settings extends BasicSettings {
public Ehcache3Settings(Config config) {
super(config);
}
public EvictionPrioritizer<Object, Object> prioritizer() {
return Prioritizer.valueOf(config().getString("ehcache3.policy").toUpperCase());
}
}
}
5 changes: 0 additions & 5 deletions simulator/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,6 @@ caffeine.simulator {
policy = "lru"
}

ehcache3 {
# Policies: Lru, Lfu, Fifo
policy = "lru"
}

infinispan {
# Policies: Lru, Lirs
policy = "lirs"
Expand Down

0 comments on commit d52a688

Please sign in to comment.