commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Cronin <...@outboundengine.com>
Subject Re: JCS jcache examples specifically with spring caching
Date Mon, 30 Jan 2017 17:09:16 GMT
is there anyone that has used the Jcache impl of JCS?



On Wed, Jan 25, 2017 at 8:48 AM, Tim Cronin <tim@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>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message