[Building Sakai] cache settings in webapp applicationcontext are not working
Earle Nietzel
earle.nietzel at gmail.com
Mon Jun 27 13:57:29 PDT 2011
Hi Steve,
Maybe because your using the same EhCacheManagerFactoryBean you need
to add the cache my_cache_name to the ehcache.xml that it was
configured with. The reason for this I am guessing is that it looks
for a configuration for <cache name="my_cache_name"> but since it
doesn't find it, it will use the default.
<cache name="my_cache_name"
maxElementsInMemory="1000"
eternal="false"
timeToIdleSeconds="43200"
timeToLiveSeconds="43200"
overflowToDisk="false"
/>
<bean id="methodCache"
class="org.springframework.cache.ehcache.EhCacheFactoryBean">
<property name="cacheManager">
<ref local="cacheManager"/>
</property>
<property name="cacheName">
<value>my_cache_name</value>
</property>
</bean>
Maybe this is a side affect of the version of spring we are on?
I am not saying sakai needs a newer version of spring but when people
want to use current features of a framework and then find out that
Sakai is using an older version of that framework it kind of sucks!
I also think the points Aaron brought are valid but you can't stay on
an old version if you intend to attract new people. For example
cacheing in spring 3 via annotations has some nice features:
http://viralpatel.net/blogs/2011/02/cache-support-spring-3-1-m1.html
Earle
Earle
On Sun, Jun 26, 2011 at 11:50 PM, Steve Swinsburg
<steve.swinsburg at gmail.com> wrote:
>
> Now that the conference is over, does anyone have input on the behaviour I'm seeing below?
> We have some cache wiring in our webapp setup to use the org.sakaiproject.MemoryService, but it's not using any of the settings I define, only the cache name itself.
> Any input would be appreciated.
> thanks,
> Steve
>
> On 07/06/2011, at 4:58 PM, Steve Swinsburg wrote:
>
> Hi all,
> I have a standalone webapp (no component, API etc) and am leveraging the Sakai MemoryService to add a cache into my app. The cache itself is working fine but the settings I define in my application context are not. In my application context I have:
> <!-- cache: ttl=12 hours -->
> <bean id="my_bean_id"
> class="org.springframework.cache.ehcache.EhCacheFactoryBean">
> <property name="cacheManager">
> <ref bean="org.sakaiproject.memory.api.MemoryService.cacheManager"/>
> </property>
> <property name="cacheName">
> <value>my_cache_name</value>
> </property>
> <property name="maxElementsInMemory" value="1000" />
> <property name="diskPersistent" value="false" />
> <property name="eternal" value="false" />
> <property name="timeToLive" value="43200" />
> <property name="timeToIdle" value="43200" />
> </bean>
>
> ie it is setup with a TTL of 12 hours (43200 seconds).
> In the Memory tool within Sakai I see it registered ok, however the TTL is back to the default of 5 minutes:
> [ name = my_cache_name status = STATUS_ALIVE eternal = false overflowToDisk = false maxElementsInMemory = 10000 maxElementsOnDisk = 0 memoryStoreEvictionPolicy = LRU timeToLiveSeconds = 300 timeToIdleSeconds = 300 diskPersistent = false diskExpiryThreadIntervalSeconds = 120 cacheEventListeners: hitCount = 8 memoryStoreHitCount = 8 diskStoreHitCount = 0 missCountNotFound = 1 missCountExpired = 1 ]
> Is it not possible to override the cache settings via my webapp's spring wiring?
> In Profile2 the cache setup is done in the component and it works so I'm thinking its only when the setup happens in the webapp. Can anyone confirm?
> cheers,
> Steve
>
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"
More information about the sakai-dev
mailing list