|
From: <viv...@ya...> - 2004-09-24 00:04:07
|
And while we're at it, (unfortunately I'm not volunteering just yet), it would be nice to develop a set of interfaces in org.springframework.cache that can be implemented by other systems: ehcache, oscache, JCS. JSR 107 spells out what the interface would look like pretty clearly (http://jcp.org/aboutJava/communityprocess/jsr/cacheFS.pdf), but there are no standard implementations of this. Every implementation of the caching system seems to support it loosely, with common methods, but there is not a common interface, so users are always tied to one particular caching product. Spring has provided this kind of common interface for a number of other areas, and caching would be great to add to it. The jcache (jcache.sourceforge.net) project seems to stay closest to the original JSR. -----Original Message----- From: spr...@li... [mailto:spr...@li...] On Behalf Of Mike Cannon-Brookes Sent: Thursday, September 23, 2004 2:53 To: spr...@li... Subject: Re: [Springframework-developer] EHCache support Dmitriy, This looks awesome to me - put it in the core! +1! I can feel a cachingSubsystemContext.xml coming on :) m On Wed, 22 Sep 2004 14:47:58 -0400, Dmitriy Kopylenko <dko...@ru...> wrote: > Mike, everyone, > > I've refined the EHCache support by allowing configuring named cache > regions via EhCacheManagerFactoryBean's properties and not requiring > ehcache.xml file anymore (if desired). > > The behavior is like this: > 1) configure EhCacheManagerFactoryBean with "configLocation" > (optional) If "configLocation" is not specified it creates a "blank" > CacheManager (with no caches defined). > 2) Configure any number of named Caches (providing cache name and > CacheManager as bean references) and optionally providing cache > properties (some or all or none - all the cache properties will have a > sensible default value) If the named cache is pre-configured in cache > config descriptor it will be used, ignoring any cache bean properties, > else the new Cache instance will be created and added to a > CacheManager for later retrieveval. Some config examples: > > <!-- Configure CacheManager from specified config location --> <bean > id="cacheManager" > class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"> > <property > name="configLocation"><value>WEB-INF/ehcache.xml</value></property> > </bean> > > <!-- Configure myCache1 region overriding the default properties. If > myCache1 is found in ehcache.xml, the properties will be ignored --> > <bean id="myCache1" > class="org.springframework.cache.ehcache.EhCacheFactoryBean"> > <property name="cacheManager"><ref local="cacheManager"/></property> > <property name="cacheName"><value>myCache1</value></property> > <property name="maxElementsInMemory"><value>20000</value></property> > <property name="overflowToDisk"><value>true</value></property> > <property name="eternal"><value>false</value></property> > <property name="timeToLive"><value>600</value></property> > <property name="timeToIdle"><value>500</value></property> > </bean> > > <!-- Configure myCache2 region overriding maxElementsInMemory property. > If myCache2 is found in ehcache.xml, the properties will be ignored > --> <bean id="myCache3" > class="org.springframework.cache.ehcache.EhCacheFactoryBean"> > <property name="cacheManager"><ref local="cacheManager"/></property> > <property name="cacheName"><value>myCache2</value></property> > <property > name="maxElementsInMemory"><value>1230000</value></property> > </bean> > > The default properties are: > - maxElementsInMemory: 10000 > - overflowToDisk: true > - eternal: false > - timeToLive: 120 > - timeToIdle: 120 > > Does this cover basic use cases? If so, I'll be happy to commit this > to the main source tree before 1.1.1 Let me know. > > Regards, > Dmitriy. > > > > > Mike Cannon-Brookes wrote: > > >Mate, > > > >I just looked at the code Dmitriy has written, and from my knowledge > >of EHCache (incidentally often referred to as Canadian cache in the > >office, or just "cache, eh?") it would be completely trivial (ie a 2 > >minute task :)) to add this? > > > >The EhCacheManagerFactoryBean already does not require an ehcache.xml > >file, it will use one if provided with one - otherwise it will just > >create a blank CacheManager. So this part works fine. > > > >The only thing to add would be a way to create new caches. > > > >In code, this is easy to do: > > > >Cache cache = new Cache("MyCache", 1000, true, false, 500, 200); > >manager.addCache(cache); > > > >There are only 6 properties for every cache (as above - cache name, > >max size, overflow to disk, eternal, time to live and time to idle). > >Why not just add these as setters to EhCacheFactoryBean, and have > >that create the cache and register it with the referenced CacheManager? > > > >What else would be required? > > > >Cheers, > >Mike > > > >ATLASSIAN - http://www.atlassian.com > > > >On Tue, 21 Sep 2004 10:40:34 +0200, jürgen höller [ werk3AT ] > ><jue...@we...> wrote: > > > > > >>Mike, > >> > >>Well, if you'd like to get rid of the ehcache.xml file, we'd have to go one step further: The current support classes for EHCache "just" specify the location of the ehcache.xml file in Spring config, and allow to pass Cache references around via IoC. We need to check how much effort completely driving EHCache configuration from Spring (similar to our LocalSessionFactoryBean does for Hibernate) would be. > >> > >>Juergen > >> > >>________________________________ > >> > >>From: spr...@li... on > >>behalf of Mike Cannon-Brookes > >>Sent: Tue 21/09/2004 07:00 > >>To: spr...@li... > >>Subject: Re: [Springframework-developer] EHCache support > >> > >> > >> > >> > >>Woo - this would be really cool. It would enable us to get rid of > >>another config file from Confluence, replacing it with yet another > >>Spring context file :) > >> > >>Cheers, > >>Mike > >> > >>ATLASSIAN - http://www.atlassian.com > >> > >>On Sun, 19 Sep 2004 11:27:54 -0500, Dmitriy Kopylenko > >><dko...@ru...> wrote: > >> > >> > >>>I've added "org.springframework.cache.ehcache.EhCacheManagerFactoryBean" > >>>and "org.springframework.cache.ehcache.EhCacheFactoryBean" to the > >>>sandbox. Please take a look at it with any suggestions and/or comments. > >>>Now, if we would provide such caching support classes, where would > >>>they live. Is "org.springframework.cache" top level package > >>>appropriate with sub packages for different caching subsystems i.e > >>>"ehcache", "oscache", etc.? If we all agree on the package for > >>>caching support classes, EHCache factory beans might make 1.1.1 > >>> > >>>Regards, > >>>Dmitriy. > >>> > >>>------------------------------------------------------- > >>>This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 > >>>Project Admins to receive an Apple iPod Mini FREE for your > >>>judgement on who ports your project to Linux PPC the best. Sponsored by IBM. > >>>Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php > >>>_______________________________________________ > >>>Springframework-developer mailing list > >>>Spr...@li... > >>>https://lists.sourceforge.net/lists/listinfo/springframework-develo > >>>per > >>> > >>> > >>> > >>------------------------------------------------------- > >>This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 > >>Project Admins to receive an Apple iPod Mini FREE for your judgement > >>on who ports your project to Linux PPC the best. Sponsored by IBM. > >>Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php > >>_______________________________________________ > >>Springframework-developer mailing list > >>Spr...@li... > >>https://lists.sourceforge.net/lists/listinfo/springframework-develop > >>er > >> > >> > >> > >> > >>------------------------------------------------------- > >>This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 > >>Project Admins to receive an Apple iPod Mini FREE for your judgement > >>on who ports your project to Linux PPC the best. Sponsored by IBM. > >>Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php > >>_______________________________________________ > >>Springframework-developer mailing list > >>Spr...@li... > >>https://lists.sourceforge.net/lists/listinfo/springframework-develop > >>er > >> > >> > >> > > > > > >------------------------------------------------------- > > > >This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 > >Project Admins to receive an Apple iPod Mini FREE for your judgement > >on who ports your project to Linux PPC the best. Sponsored by IBM. > >Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php > >_______________________________________________ > >Springframework-developer mailing list > >Spr...@li... > >https://lists.sourceforge.net/lists/listinfo/springframework-develope > >r > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 > Project Admins to receive an Apple iPod Mini FREE for your judgement > on who ports your project to Linux PPC the best. Sponsored by IBM. > Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > -- ATLASSIAN - http://www.atlassian.com ------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer __________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! http://promotions.yahoo.com/new_mail |