Unable To Change File Cache Location 5.1.0CR2
julesyasuna Jan 11, 2012 10:25 AMprogramatically setting the location of the cache on disk as follows
private static Configuration buildDefaultConfiguration()
{
return new ConfigurationBuilder()
.jmxStatistics().enabled(true)
.loaders().addFileCacheStore().fetchPersistentState(true).purgeSynchronously(false).ignoreModifications(false).purgeOnStartup(true).location("D:\tmp\mycache")
.eviction().strategy(EvictionStrategy.LRU).maxEntries(6000)
.expiration().lifespan(1000 * 60 * 60 * 24).maxIdle(1000 * 60 * 80 * 24)
.build();
}
but the directory that is created is still alway "Infinispan-FileCacheStore"
looking at the source code is see the following in LegacyConfigurationAdaptor startng at Line 173
public class LegacyConfigurationAdaptor {
.
.
. about Line 173 ...
} else if (loader instanceof FileCacheStoreConfiguration) {
FileCacheStoreConfig fcsc = new FileCacheStoreConfig();
clc = fcsc;
String location = loader.properties().getProperty("location");
if (location != null)
fcsc.location(location);
}
i am wondwering if this line ....
String location = loader.properties().getProperty("location");
should be someting like this ...
String location =( (FileCacheStoreConfiguration) loader).getLocation();
now. I can fix this using withProperties() method ....
private static Configuration buildDefaultConfiguration()
{
final Properties properties = new Properties();
properties.setProperty("location", "D:\tmp\mycache");
return new ConfigurationBuilder()
.jmxStatistics().enabled(true)
.loaders().addFileCacheStore().fetchPersistentState(true).purgeSynchronously(false).ignoreModifications(false).purgeOnStartup(true).location("D:\tmp\mycache").withProperties(properties)
.eviction().strategy(EvictionStrategy.LRU).maxEntries(6000)
.expiration().lifespan(1000 * 60 * 60 * 24).maxIdle(1000 * 60 * 80 * 24)
.build();
}
just wondering if I should have to do this ?