|
From: Mike Cannon-B. <mca...@gm...> - 2004-09-23 06:53:31
|
Dmitriy,
This looks awesome to me - put it in the core! +1!=20
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,
>=20
> 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).
>=20
> 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:
>=20
> <!-- Configure CacheManager from specified config location -->
> <bean id=3D"cacheManager"
> class=3D"org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
> <property
> name=3D"configLocation"><value>WEB-INF/ehcache.xml</value></property>
> </bean>
>=20
> <!-- Configure myCache1 region overriding the default properties. If
> myCache1 is found in ehcache.xml, the properties will be ignored -->
> <bean id=3D"myCache1"
> class=3D"org.springframework.cache.ehcache.EhCacheFactoryBean">
> <property name=3D"cacheManager"><ref local=3D"cacheManager"/></pr=
operty>
> <property name=3D"cacheName"><value>myCache1</value></property>
> <property name=3D"maxElementsInMemory"><value>20000</value></prop=
erty>
> <property name=3D"overflowToDisk"><value>true</value></property>
> <property name=3D"eternal"><value>false</value></property>
> <property name=3D"timeToLive"><value>600</value></property>
> <property name=3D"timeToIdle"><value>500</value></property>
> </bean>
>=20
> <!-- Configure myCache2 region overriding maxElementsInMemory property.
> If myCache2 is found in ehcache.xml, the properties will be ignored -->
> <bean id=3D"myCache3"
> class=3D"org.springframework.cache.ehcache.EhCacheFactoryBean">
> <property name=3D"cacheManager"><ref local=3D"cacheManager"/></pr=
operty>
> <property name=3D"cacheName"><value>myCache2</value></property>
> <property
> name=3D"maxElementsInMemory"><value>1230000</value></property>
> </bean>
>=20
> The default properties are:
> - maxElementsInMemory: 10000
> - overflowToDisk: true
> - eternal: false
> - timeToLive: 120
> - timeToIdle: 120
>=20
> 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.
>=20
> Regards,
> Dmitriy.
>=20
>=20
>=20
>=20
> Mike Cannon-Brookes wrote:
>=20
> >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 =3D 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=FCrgen h=F6ller [ 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 t=
he location of the ehcache.xml file in Spring config, and allow to pass Cac=
he references around via IoC. We need to check how much effort completely d=
riving EHCache configuration from Spring (similar to our LocalSessionFactor=
yBean does for Hibernate) would be.
> >>
> >>Juergen
> >>
> >>________________________________
> >>
> >>From: spr...@li... on behalf o=
f 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.EhCacheManagerFactoryBea=
n"
> >>>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 the=
y
> >>>live. Is "org.springframework.cache" top level package appropriate wit=
h
> >>>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 o=
n
> >>>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
> >>>
> >>>
> >>>
> >>-------------------------------------------------------
> >>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
> >>
> >>
> >>
> >>
> >>-------------------------------------------------------
> >>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
> >>
> >>
> >>
> >
> >
> >-------------------------------------------------------
>=20
>=20
> >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
> >
> >
>=20
> -------------------------------------------------------
> 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
>=20
--=20
ATLASSIAN - http://www.atlassian.com
|