on 01-10-2006 9:43 AM
I want to create a new KM cache which is not preconfigured.
According to https://media.sdn.sap.com/javadocs/NW04/SP12/km/com/sapportals/wcm/util/cache/CacheFactory.html
this should be possible with the getCache(String cacheID, Properties properties) method.
I tried the following code:
String cacheID = CacheFactory.getUniqueCacheID();
Properties cacheProp = new Properties(); cacheProp.setProperty(CacheFactory.CFG_MAX_CACHE_SIZE_KEY, "1000000"); cacheProp.setProperty(CacheFactory.CFG_CAPACITY_KEY, "500"); cacheProp.setProperty(CacheFactory.CFG_MAX_ENTRY_SIZE_KEY, "500");
cacheProp.setProperty(CacheFactory.CFG_AVERAGE_ENTRY_SIZE_KEY, "20000"); cacheProp.setProperty(CacheFactory.CFG_SINGLETON_KEY, "true");
cacheProp.setProperty(CacheFactory.CFG_DEFAULT_TIME_TO_LIVE_KEY, "0"); cacheProp.setProperty(CacheFactory.CFG_STORAGE_CLASS_KEY,CacheFactory.CFG_MEMORY_KEY);
try {
CacheFactory cacheFac = CacheFactory.getInstance();
cache = cacheFac.getCache(cacheID, cacheProp);
} catch (Exception e) {
e.printStackTrace();
}
Unfortunately I always get an exception. Is where any other property what I have to set?
Hi!
Mandatory cache properties are:
CacheFactory.CFG_CACHE_CLASS_KEY, e.g. ICache.DEFAULT_CACHE_CLASS (for memory caches)
CacheFactory.CFG_CACHE_TYPE_KEY, e.g. CacheFactory.CFG_MEMORY_KEY (for memory caches)
CacheFactory.CFG_SINGLETON_KEY, e.g. ICache.DEFAULT_SINGLETON (true)
CacheFactory.CFG_STORAGE_CLASS_KEY is needed only for persistent caches and will contain
a Java class that stores the content in the filesystem.
bye, Dirk
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
10 | |
8 | |
6 | |
6 | |
6 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.