Skip to content

Commit

Permalink
Conversion from Cache to LoadingCache does not compile, perhaps you h…
Browse files Browse the repository at this point in the history
…ave a different version of google common?
  • Loading branch information
hoqhuuep committed Jul 12, 2015
1 parent 5fd4e3f commit e889d09
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
import com.github.hoqhuuep.islandcraft.api.ICRegion;
import com.github.hoqhuuep.islandcraft.api.ICWorld;
import com.github.hoqhuuep.islandcraft.api.IslandDistribution;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;

public class DefaultWorld implements ICWorld {
private final String worldName;
Expand All @@ -29,7 +29,7 @@ public class DefaultWorld implements ICWorld {
private final List<String> islandGenerators;
private final IslandCache cache;
private final ICClassLoader classLoader;
private final LoadingCache<ICLocation, ICIsland> databaseCache;
private final Cache<ICLocation, ICIsland> databaseCache;

public DefaultWorld(final String name, final long seed, final IslandDatabase database, final ConfigurationSection config, final IslandCache cache, final ICClassLoader classLoader) {
this.worldName = name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
import com.github.hoqhuuep.islandcraft.api.BiomeDistribution;
import com.github.hoqhuuep.islandcraft.api.IslandDistribution;
import com.github.hoqhuuep.islandcraft.api.IslandGenerator;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;

public class ICClassLoader {
private final LoadingCache<String, IslandDistribution> islandDistributionCache;
private final LoadingCache<String, IslandGenerator> islandGeneratorCache;
private final LoadingCache<String, BiomeDistribution> biomeDistributionCache;
private final Cache<String, IslandDistribution> islandDistributionCache;
private final Cache<String, IslandGenerator> islandGeneratorCache;
private final Cache<String, BiomeDistribution> biomeDistributionCache;

public ICClassLoader() {
islandDistributionCache = CacheBuilder.newBuilder().build(new StringConstructorCacheLoader<IslandDistribution>());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

import com.github.hoqhuuep.islandcraft.api.ICBiome;
import com.github.hoqhuuep.islandcraft.api.ICIsland;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;

public class IslandCache {
private final LoadingCache<ICIsland, ICBiome[]> cache;
private final Cache<ICIsland, ICBiome[]> cache;

public IslandCache() {
cache = CacheBuilder.newBuilder().expireAfterAccess(30, TimeUnit.SECONDS).build(new IslandCacheLoader());
Expand Down

1 comment on commit e889d09

@boy0001
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, that's very interesting since the version I compiled with LoadingCache compiled and worked. Oh well :p

Please sign in to comment.