You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Tim Cronin <ti...@outboundengine.com> on 2017/01/25 14:48:22 UTC
JCS jcache examples specifically with spring caching
I'm trying to leverage Spring caching using jcs cache
the javadocs show only ctor for the JCSCachingManager.
https://commons.apache.org/proper/commons-jcs/commons-jcs-jcache/apidocs/src-html/org/apache/commons/jcs/jcache/JCSCachingManager.html#line.83
but i pass in what seems more like default values
public static void main(String[] args) throws Exception
{
JCSCachingProvider provider = new JCSCachingProvider();
Properties props = new Properties();
CacheManager cacheMgr = new JCSCachingManager(provider,
JCSCachingProvider.DEFAULT_URI,
Thread.currentThread().getContextClassLoader(),
props);
//... do cache stuff...
cacheMgr.close();
}
I'm trying to fit this into an existing webapp that uses xml base
configuration
and having to set the defaults seems problematic, I'd have to wrap it to get
proper current class load or use system which doesn't map to webapp loader
Is there any reason for not having a default Ctor?
<!-- cjs cache manager setup -->
<beans:bean id="cache.provider" class="org.apache.commons.jcs.
jcache.JCSCachingProvider"/>
<beans:bean id="cache.url" class="org.apache.commons.jcs.
jcache.JCSCachingProvider.DEFAULT_URI"/>
<!-- this seems hacky should be a -->
<beans:bean id="cache.classloader" class="java.lang.Class"
factory-method="getSystemClassLoader" />
<beans:bean id="cache.properties" class="java.util.Properties"/>
<beans:bean id="cache.manager" class="org.apache.commons.jcs.
jcache.JCSCachingManager">
<beans:constructor-arg ref="cache.provider" />
<beans:constructor-arg ref="cache.url" />
<beans:constructor-arg ref="cache.classloader" />
<beans:constructor-arg ref="cache.properties" />
</beans:bean>
Re: JCS jcache examples specifically with spring caching
Posted by Romain Manni-Bucau <rm...@gmail.com>.
2017-01-25 20:37 GMT+01:00 Tim Cronin <ti...@outboundengine.com>:
> still playing around with the jcache impl (see attached)
>
> I created the cache using jcache functionality but if I try to access it
> via native jcs it shows the cache as empty.
>
>
Right, we isolate managers to avoid issues (the singleton pattern taking a
default instance and not the one you get through JCache for instance).
> so you're are unable to manage the caches via JCSAdmin.
>
>
true and false (depend what JCSAdmin references there)
you can use JCSAdminBean (JMX MBean) to administrate your cache (or expose
it through HTTP through jolokia), there is one per manager instance
registered with a different name
the servlet will obvious not work since it uses the default instance
> but could have something misconfigured
>
>
> public final class CacheImpl {
>
> /**
> * Document Me!!!
> * @param args
> */
> public static void main(String[] args) {
> JCSCachingProvider provider = new JCSCachingProvider();
> Properties props = new Properties();
>
> CacheManager cacheMgr = new JCSCachingManager(provider,
> URI.create("file:///C:/Users/Tim/workspace/Jcache/conf/
> cache.ccf"),
> Thread.currentThread().getContextClassLoader(),
> props);
>
> JCSConfiguration<String, String> configuration = new
> JCSConfiguration<>(new MutableConfiguration(), String.class, String.class);
>
> Cache<String, String> testCache = cacheMgr.createCache("test",
> configuration);
>
> for(int cnt = 0; cnt < 200; cnt++) {
> testCache.put("key-" + cnt, "value-" + cnt);
> }
>
> for(int cnt = 0; cnt < 200; cnt++) {
> if(testCache.containsKey("key-" + cnt)) {
> System.out.println("hit key-" + cnt);
> } else {
> System.out.println("miss key-" + cnt);
> }
> }
>
> dumpJCache(testCache);
> dumpJCS("test");
>
> cacheMgr.close();
> }
>
> private static void dumpJCache(Cache<String, String> cache) {
> StringBuilder buff = new StringBuilder();
> try {
> buff.append("jcache: ").append(cache.getName()).append("
> closed ").append(cache.isClosed()).append('\n');
>
> Iterator<Cache.Entry<String, String>> i = cache.iterator();
>
> while(i.hasNext()){
> Cache.Entry<String, String> entry = i.next();
> buff.append("key[").append(entry.getKey()).append("]
> value[").append(entry.getValue()).append( "]\n");
> }
>
> } catch (Exception e) {
> StringWriter out = new StringWriter(512);
> e.printStackTrace(new PrintWriter(out));
> buff.append(out.toString());
> }
>
> System.out.println(buff.toString());
> }
>
> private static void dumpJCS(String cacheName) {
> StringBuilder buff = new StringBuilder();
> try {
> CacheAccess<String, String> cache = JCS.getInstance(cacheName);
>
> buff.append("jcs: ").append(cache.getCacheAttributes().getCacheName()).append("
> status ").append(cache.getStats()).append('\n');
>
> Set<String> keys = cache.getCacheControl().getKeySet();
>
> if(keys.isEmpty()) {
> } else {
> for(String key : cache.getCacheControl().getKeySet()){
> buff.append("key[").append(
> key).append("]value[").append(cache.get(key)).append( "]\n");
> }
> }
>
> } catch (Exception e) {
> StringWriter out = new StringWriter(512);
> e.printStackTrace(new PrintWriter(out));
> buff.append(out.toString());
> }
>
> System.out.println(buff.toString());
> }
>
> cache.ccf:
>
> ##################################################################
> # JCS cache configuration
> #
> # JCS homepage: https://commons.apache.org/proper/commons-jcs/
> ##################################################################
>
> ##################################################################
> # default mem cache settings
> ##################################################################
> jcs.default=DC
> jcs.default.cacheattributes=org.apache.commons.jcs.engine.
> CompositeCacheAttributes
> jcs.default.cacheattributes.MemoryCacheName=org.apache.
> commons.jcs.engine.memory.lru.LRUMemoryCache
> jcs.default.cacheattributes.UseMemoryShrinker=true
> jcs.default.cacheattributes.MaxMemoryIdleTimeSeconds=3600
> jcs.default.cacheattributes.ShrinkerIntervalSeconds=300
> jcs.default.cacheattributes.MaxSpoolPerRun=64
> jcs.default.cacheattributes.DiskUsagePatternName=UPDATE
>
> ##################################################################
> # default element attributes
> ##################################################################
> jcs.default.elementattributes=org.apache.commons.jcs.engine.
> ElementAttributes
> jcs.default.elementattributes.MaxLife=-1
> jcs.default.elementattributes.IdleTime=-1
> jcs.default.elementattributes.IsEternal=true
> jcs.default.elementattributes.IsSpool=true
> jcs.default.elementattributes.IsRemote=false
> jcs.default.elementattributes.IsLateral=false
>
> ##################################################################
> # default disk cache settings
> ##################################################################
> jcs.auxiliary.DC=org.apache.commons.jcs.auxiliary.disk.indexed.
> IndexedDiskCacheFactory
> jcs.auxiliary.DC.attributes=org.apache.commons.jcs.auxiliary.disk.indexed.
> IndexedDiskCacheAttributes
> jcs.auxiliary.DC.attributes.DiskPath=${user.home}/test-cache/
> jcs.auxiliary.DC.attributes.MaxPurgatorySize=512
> jcs.auxiliary.DC.attributes.MaxKeySize=8096
> jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=256
> jcs.auxiliary.DC.attributes.OptimizeOnShutdown=true
> jcs.auxiliary.DC.attributes.EventQueueType=POOLED
> jcs.auxiliary.DC.attributes.EventQueuePoolName=disk_cache_event_queue
>
> ##################################################################
> # Disk Cache pool
> ##################################################################
> thread_pool.disk_cache_event_queue.boundarySize=50
> thread_pool.disk_cache_event_queue.useBoundary=true
> thread_pool.disk_cache_event_queue.maximumPoolSize=30
> thread_pool.disk_cache_event_queue.minimumPoolSize=4
> thread_pool.disk_cache_event_queue.keepAliveTime=3500
> thread_pool.disk_cache_event_queue.startUpSize=4
> thread_pool.disk_cache_event_queue.whenBlockedPolicy=RUN
>
> ##################################################################
> # test
> ##################################################################
> jcs.region.test.cacheattributes.MaxObjects=100
> jcs.region.test.elementattributes.IsEternal=false
> jcs.region.test.elementattributes.MaxLife=2000000
> jcs.region.test.elementattributes.IdleTime=1800
>
>
>
> On Wed, Jan 25, 2017 at 8:48 AM, Tim Cronin <ti...@outboundengine.com>
> wrote:
>
>> I'm trying to leverage Spring caching using jcs cache
>> the javadocs show only ctor for the JCSCachingManager.
>> https://commons.apache.org/proper/commons-jcs/commons-jcs-
>> jcache/apidocs/src-html/org/apache/commons/jcs/jcache/JCSC
>> achingManager.html#line.83
>>
>> but i pass in what seems more like default values
>>
>> public static void main(String[] args) throws Exception
>> {
>> JCSCachingProvider provider = new JCSCachingProvider();
>> Properties props = new Properties();
>>
>> CacheManager cacheMgr = new JCSCachingManager(provider,
>> JCSCachingProvider.DEFAULT_URI,
>> Thread.currentThread().getContextClassLoader(),
>> props);
>>
>> //... do cache stuff...
>>
>> cacheMgr.close();
>>
>> }
>>
>> I'm trying to fit this into an existing webapp that uses xml base
>> configuration
>> and having to set the defaults seems problematic, I'd have to wrap it to
>> get
>> proper current class load or use system which doesn't map to webapp loader
>>
>> Is there any reason for not having a default Ctor?
>>
>> <!-- cjs cache manager setup -->
>> <beans:bean id="cache.provider" class="org.apache.commons.jcs.
>> jcache.JCSCachingProvider"/>
>> <beans:bean id="cache.url" class="org.apache.commons.jcs.
>> jcache.JCSCachingProvider.DEFAULT_URI"/>
>> <!-- this seems hacky should be a -->
>> <beans:bean id="cache.classloader" class="java.lang.Class"
>> factory-method="getSystemClassLoader" />
>> <beans:bean id="cache.properties" class="java.util.Properties"/>
>>
>> <beans:bean id="cache.manager" class="org.apache.commons.jcs.
>> jcache.JCSCachingManager">
>> <beans:constructor-arg ref="cache.provider" />
>> <beans:constructor-arg ref="cache.url" />
>> <beans:constructor-arg ref="cache.classloader" />
>> <beans:constructor-arg ref="cache.properties" />
>> </beans:bean>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
Re: JCS jcache examples specifically with spring caching
Posted by Tim Cronin <ti...@outboundengine.com>.
still playing around with the jcache impl (see attached)
I created the cache using jcache functionality but if I try to access it
via native jcs it shows the cache as empty.
so you're are unable to manage the caches via JCSAdmin.
but could have something misconfigured
public final class CacheImpl {
/**
* Document Me!!!
* @param args
*/
public static void main(String[] args) {
JCSCachingProvider provider = new JCSCachingProvider();
Properties props = new Properties();
CacheManager cacheMgr = new JCSCachingManager(provider,
URI.create("file:///C:/Users/Tim/workspace/Jcache/conf/cache.ccf"),
Thread.currentThread().getContextClassLoader(),
props);
JCSConfiguration<String, String> configuration = new
JCSConfiguration<>(new MutableConfiguration(), String.class, String.class);
Cache<String, String> testCache = cacheMgr.createCache("test",
configuration);
for(int cnt = 0; cnt < 200; cnt++) {
testCache.put("key-" + cnt, "value-" + cnt);
}
for(int cnt = 0; cnt < 200; cnt++) {
if(testCache.containsKey("key-" + cnt)) {
System.out.println("hit key-" + cnt);
} else {
System.out.println("miss key-" + cnt);
}
}
dumpJCache(testCache);
dumpJCS("test");
cacheMgr.close();
}
private static void dumpJCache(Cache<String, String> cache) {
StringBuilder buff = new StringBuilder();
try {
buff.append("jcache: ").append(cache.getName()).append(" closed
").append(cache.isClosed()).append('\n');
Iterator<Cache.Entry<String, String>> i = cache.iterator();
while(i.hasNext()){
Cache.Entry<String, String> entry = i.next();
buff.append("key[").append(entry.getKey()).append("]value[").append(entry.getValue()).append(
"]\n");
}
} catch (Exception e) {
StringWriter out = new StringWriter(512);
e.printStackTrace(new PrintWriter(out));
buff.append(out.toString());
}
System.out.println(buff.toString());
}
private static void dumpJCS(String cacheName) {
StringBuilder buff = new StringBuilder();
try {
CacheAccess<String, String> cache = JCS.getInstance(cacheName);
buff.append("jcs:
").append(cache.getCacheAttributes().getCacheName()).append(" status
").append(cache.getStats()).append('\n');
Set<String> keys = cache.getCacheControl().getKeySet();
if(keys.isEmpty()) {
} else {
for(String key : cache.getCacheControl().getKeySet()){
buff.append("key[").append(key).append("]value[").append(cache.get(key)).append(
"]\n");
}
}
} catch (Exception e) {
StringWriter out = new StringWriter(512);
e.printStackTrace(new PrintWriter(out));
buff.append(out.toString());
}
System.out.println(buff.toString());
}
cache.ccf:
##################################################################
# JCS cache configuration
#
# JCS homepage: https://commons.apache.org/proper/commons-jcs/
##################################################################
##################################################################
# default mem cache settings
##################################################################
jcs.default=DC
jcs.default.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.default.cacheattributes.MemoryCacheName=org.apache.commons.jcs.engine.memory.lru.LRUMemoryCache
jcs.default.cacheattributes.UseMemoryShrinker=true
jcs.default.cacheattributes.MaxMemoryIdleTimeSeconds=3600
jcs.default.cacheattributes.ShrinkerIntervalSeconds=300
jcs.default.cacheattributes.MaxSpoolPerRun=64
jcs.default.cacheattributes.DiskUsagePatternName=UPDATE
##################################################################
# default element attributes
##################################################################
jcs.default.elementattributes=org.apache.commons.jcs.engine.ElementAttributes
jcs.default.elementattributes.MaxLife=-1
jcs.default.elementattributes.IdleTime=-1
jcs.default.elementattributes.IsEternal=true
jcs.default.elementattributes.IsSpool=true
jcs.default.elementattributes.IsRemote=false
jcs.default.elementattributes.IsLateral=false
##################################################################
# default disk cache settings
##################################################################
jcs.auxiliary.DC=org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
jcs.auxiliary.DC.attributes=org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
jcs.auxiliary.DC.attributes.DiskPath=${user.home}/test-cache/
jcs.auxiliary.DC.attributes.MaxPurgatorySize=512
jcs.auxiliary.DC.attributes.MaxKeySize=8096
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=256
jcs.auxiliary.DC.attributes.OptimizeOnShutdown=true
jcs.auxiliary.DC.attributes.EventQueueType=POOLED
jcs.auxiliary.DC.attributes.EventQueuePoolName=disk_cache_event_queue
##################################################################
# Disk Cache pool
##################################################################
thread_pool.disk_cache_event_queue.boundarySize=50
thread_pool.disk_cache_event_queue.useBoundary=true
thread_pool.disk_cache_event_queue.maximumPoolSize=30
thread_pool.disk_cache_event_queue.minimumPoolSize=4
thread_pool.disk_cache_event_queue.keepAliveTime=3500
thread_pool.disk_cache_event_queue.startUpSize=4
thread_pool.disk_cache_event_queue.whenBlockedPolicy=RUN
##################################################################
# test
##################################################################
jcs.region.test.cacheattributes.MaxObjects=100
jcs.region.test.elementattributes.IsEternal=false
jcs.region.test.elementattributes.MaxLife=2000000
jcs.region.test.elementattributes.IdleTime=1800
On Wed, Jan 25, 2017 at 8:48 AM, Tim Cronin <ti...@outboundengine.com> wrote:
> I'm trying to leverage Spring caching using jcs cache
> the javadocs show only ctor for the JCSCachingManager.
> https://commons.apache.org/proper/commons-jcs/commons-
> jcs-jcache/apidocs/src-html/org/apache/commons/jcs/jcache/
> JCSCachingManager.html#line.83
>
> but i pass in what seems more like default values
>
> public static void main(String[] args) throws Exception
> {
> JCSCachingProvider provider = new JCSCachingProvider();
> Properties props = new Properties();
>
> CacheManager cacheMgr = new JCSCachingManager(provider,
> JCSCachingProvider.DEFAULT_URI,
> Thread.currentThread().getContextClassLoader(),
> props);
>
> //... do cache stuff...
>
> cacheMgr.close();
>
> }
>
> I'm trying to fit this into an existing webapp that uses xml base
> configuration
> and having to set the defaults seems problematic, I'd have to wrap it to
> get
> proper current class load or use system which doesn't map to webapp loader
>
> Is there any reason for not having a default Ctor?
>
> <!-- cjs cache manager setup -->
> <beans:bean id="cache.provider" class="org.apache.commons.jcs.
> jcache.JCSCachingProvider"/>
> <beans:bean id="cache.url" class="org.apache.commons.jcs.
> jcache.JCSCachingProvider.DEFAULT_URI"/>
> <!-- this seems hacky should be a -->
> <beans:bean id="cache.classloader" class="java.lang.Class"
> factory-method="getSystemClassLoader" />
> <beans:bean id="cache.properties" class="java.util.Properties"/>
>
> <beans:bean id="cache.manager" class="org.apache.commons.jcs.
> jcache.JCSCachingManager">
> <beans:constructor-arg ref="cache.provider" />
> <beans:constructor-arg ref="cache.url" />
> <beans:constructor-arg ref="cache.classloader" />
> <beans:constructor-arg ref="cache.properties" />
> </beans:bean>
>
>
Re: JCS jcache examples specifically with spring caching
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi
this is not the way to use JCache in spring, Use spring method factory bean
to do:
provider=Caching.getCachingProvider(), destroy method will be close()
then you can do through the same factory:
// the provider can give you default values for these params if you want
manager=provider.getCacheManager(configUri, classloader)
then if you want to create a cache:
// here javax.cache.configuration.MutableConfiguration will be spring
friendly
cache=manager.createCache(name, configuration)
Don't try to use directly JCS implementation, this is not intended to be
done and not supposed to stable in term of user API (this is really an
internal of JCS where JCache API is public for these classes)
Let me know if you need some help for next step (ie using
the methodinvokingfactorybean)
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://blog-rmannibucau.rhcloud.com> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>
2017-01-25 15:48 GMT+01:00 Tim Cronin <ti...@outboundengine.com>:
> I'm trying to leverage Spring caching using jcs cache
> the javadocs show only ctor for the JCSCachingManager.
> https://commons.apache.org/proper/commons-jcs/commons-
> jcs-jcache/apidocs/src-html/org/apache/commons/jcs/jcache/
> JCSCachingManager.html#line.83
>
> but i pass in what seems more like default values
>
> public static void main(String[] args) throws Exception
> {
> JCSCachingProvider provider = new JCSCachingProvider();
> Properties props = new Properties();
>
> CacheManager cacheMgr = new JCSCachingManager(provider,
> JCSCachingProvider.DEFAULT_URI,
> Thread.currentThread().getContextClassLoader(),
> props);
>
> //... do cache stuff...
>
> cacheMgr.close();
>
> }
>
> I'm trying to fit this into an existing webapp that uses xml base
> configuration
> and having to set the defaults seems problematic, I'd have to wrap it to
> get
> proper current class load or use system which doesn't map to webapp loader
>
> Is there any reason for not having a default Ctor?
>
> <!-- cjs cache manager setup -->
> <beans:bean id="cache.provider" class="org.apache.commons.jcs.
> jcache.JCSCachingProvider"/>
> <beans:bean id="cache.url" class="org.apache.commons.jcs.
> jcache.JCSCachingProvider.DEFAULT_URI"/>
> <!-- this seems hacky should be a -->
> <beans:bean id="cache.classloader" class="java.lang.Class"
> factory-method="getSystemClassLoader" />
> <beans:bean id="cache.properties" class="java.util.Properties"/>
>
> <beans:bean id="cache.manager" class="org.apache.commons.jcs.
> jcache.JCSCachingManager">
> <beans:constructor-arg ref="cache.provider" />
> <beans:constructor-arg ref="cache.url" />
> <beans:constructor-arg ref="cache.classloader" />
> <beans:constructor-arg ref="cache.properties" />
> </beans:bean>
>
Re: JCS jcache examples specifically with spring caching
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Not sure with spring but we have users in prod yes (we already got feedback
through tomee list / IRC / privately)
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://blog-rmannibucau.rhcloud.com> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>
2017-01-30 18:09 GMT+01:00 Tim Cronin <ti...@outboundengine.com>:
> is there anyone that has used the Jcache impl of JCS?
>
>
>
> On Wed, Jan 25, 2017 at 8:48 AM, Tim Cronin <ti...@outboundengine.com>
> wrote:
>
> > I'm trying to leverage Spring caching using jcs cache
> > the javadocs show only ctor for the JCSCachingManager.
> > https://commons.apache.org/proper/commons-jcs/commons-
> > jcs-jcache/apidocs/src-html/org/apache/commons/jcs/jcache/
> > JCSCachingManager.html#line.83
> >
> > but i pass in what seems more like default values
> >
> > public static void main(String[] args) throws Exception
> > {
> > JCSCachingProvider provider = new JCSCachingProvider();
> > Properties props = new Properties();
> >
> > CacheManager cacheMgr = new JCSCachingManager(provider,
> > JCSCachingProvider.DEFAULT_URI,
> > Thread.currentThread().getContextClassLoader(),
> > props);
> >
> > //... do cache stuff...
> >
> > cacheMgr.close();
> >
> > }
> >
> > I'm trying to fit this into an existing webapp that uses xml base
> > configuration
> > and having to set the defaults seems problematic, I'd have to wrap it to
> > get
> > proper current class load or use system which doesn't map to webapp
> loader
> >
> > Is there any reason for not having a default Ctor?
> >
> > <!-- cjs cache manager setup -->
> > <beans:bean id="cache.provider" class="org.apache.commons.jcs.
> > jcache.JCSCachingProvider"/>
> > <beans:bean id="cache.url" class="org.apache.commons.jcs.
> > jcache.JCSCachingProvider.DEFAULT_URI"/>
> > <!-- this seems hacky should be a -->
> > <beans:bean id="cache.classloader" class="java.lang.Class"
> > factory-method="getSystemClassLoader" />
> > <beans:bean id="cache.properties" class="java.util.Properties"/>
> >
> > <beans:bean id="cache.manager" class="org.apache.commons.jcs.
> > jcache.JCSCachingManager">
> > <beans:constructor-arg ref="cache.provider" />
> > <beans:constructor-arg ref="cache.url" />
> > <beans:constructor-arg ref="cache.classloader" />
> > <beans:constructor-arg ref="cache.properties" />
> > </beans:bean>
> >
> >
>
Re: JCS jcache examples specifically with spring caching
Posted by Tim Cronin <ti...@outboundengine.com>.
is there anyone that has used the Jcache impl of JCS?
On Wed, Jan 25, 2017 at 8:48 AM, Tim Cronin <ti...@outboundengine.com> wrote:
> I'm trying to leverage Spring caching using jcs cache
> the javadocs show only ctor for the JCSCachingManager.
> https://commons.apache.org/proper/commons-jcs/commons-
> jcs-jcache/apidocs/src-html/org/apache/commons/jcs/jcache/
> JCSCachingManager.html#line.83
>
> but i pass in what seems more like default values
>
> public static void main(String[] args) throws Exception
> {
> JCSCachingProvider provider = new JCSCachingProvider();
> Properties props = new Properties();
>
> CacheManager cacheMgr = new JCSCachingManager(provider,
> JCSCachingProvider.DEFAULT_URI,
> Thread.currentThread().getContextClassLoader(),
> props);
>
> //... do cache stuff...
>
> cacheMgr.close();
>
> }
>
> I'm trying to fit this into an existing webapp that uses xml base
> configuration
> and having to set the defaults seems problematic, I'd have to wrap it to
> get
> proper current class load or use system which doesn't map to webapp loader
>
> Is there any reason for not having a default Ctor?
>
> <!-- cjs cache manager setup -->
> <beans:bean id="cache.provider" class="org.apache.commons.jcs.
> jcache.JCSCachingProvider"/>
> <beans:bean id="cache.url" class="org.apache.commons.jcs.
> jcache.JCSCachingProvider.DEFAULT_URI"/>
> <!-- this seems hacky should be a -->
> <beans:bean id="cache.classloader" class="java.lang.Class"
> factory-method="getSystemClassLoader" />
> <beans:bean id="cache.properties" class="java.util.Properties"/>
>
> <beans:bean id="cache.manager" class="org.apache.commons.jcs.
> jcache.JCSCachingManager">
> <beans:constructor-arg ref="cache.provider" />
> <beans:constructor-arg ref="cache.url" />
> <beans:constructor-arg ref="cache.classloader" />
> <beans:constructor-arg ref="cache.properties" />
> </beans:bean>
>
>