Announcement Announcement Module

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions ( project, this forum has been decommissioned in favour of Spring Extensions one at:

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Costin Leau
SpringSource - Spring Training, Consulting, and Support - "From the Source"
See more
See less
Cache not flushed Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cache not flushed

    Hi all,

    I'm using the OSCache integration from SprindModules, and it really improves the performance of the app, but I can't get the cache to flush.

    Here goes an excerpt of the config:

    	<bean id="baseDao"    class="org.springmodules.cache.interceptor.proxy.CacheProxyFactoryBean">
    	    <property name="cacheProviderFacade">
    		<ref local="cacheProvider" />
    	    <property name="cachingAttributes">
    		     <prop key="obtenirTotesFasesProduccio">[cacheProfileId=cacheWheels]</prop>
    	    <property name="cacheFlushAttributes">
    		    <prop key="actualitzarFase">[cacheProfileIds=cacheWheels][flushBeforeExecution=true]</prop>
    	    <property name="target">
    		<ref bean="baseDaoTarget"/>
    ...the idea is to cache results from "obtenirTotesFasesProduccio", and flush before executing "actualitzarFase" in "baseDaoTarget".

    I've enable debugging:

    The first call gets cached:
    2006-02-10 12:58:43,818 DEBUG [] - Initializing transaction synchronization
    2006-02-10 12:58:43,818 DEBUG [org.springmodules.cache.provider.AbstractCacheProviderFacadeImpl] - Method 'getFromCache(CacheKey, String)'. Argument 'cacheKey': 629|22072380
    2006-02-10 12:58:43,818 DEBUG [org.springmodules.cache.provider.AbstractCacheProviderFacadeImpl] - Method 'getCacheProfile(String)'. Argument 'cacheProfileId': cacheWheels
    2006-02-10 12:58:43,818 DEBUG [org.springmodules.cache.provider.AbstractCacheProviderFacadeImpl] - Method 'getCacheProfile(String)'. Variable 'cacheProfile': [email protected][refreshPeriod=<null>,groups=<null>,cronExpression=<null>]
    2006-02-10 12:58:43,818 DEBUG [com.opensymphony.oscache.base.algorithm.AbstractConcurrentReadCache] - get called (key=629|22072380)
    2006-02-10 12:58:43,818 DEBUG [com.opensymphony.oscache.base.algorithm.AbstractConcurrentReadCache] - persistRetrieve called (key=629|22072380)
    2006-02-10 12:58:43,818 DEBUG [com.opensymphony.oscache.base.Cache] - No cache entry exists for key='629|22072380', creating
    2006-02-10 12:58:43,819 DEBUG [org.springmodules.cache.provider.oscache.OsCacheFacade] - Method 'getFromCache(..)'. Object not found in the OSCache cache
    2006-02-10 12:58:43,819 DEBUG [org.springmodules.cache.provider.AbstractCacheProviderFacadeImpl] - Method 'getFromCache(CacheKey, String)'. Variable 'cachedObject': null
    Later, a call to "actualitzarFase" generates the following log (so the cache seems to be cleared):

    2006-02-10 12:58:50,031 DEBUG [] - Initializing transaction synchronization
    2006-02-10 12:58:50,031 DEBUG [org.springmodules.cache.provider.AbstractCacheProviderFacadeImpl] - Method 'flushCache(String[])'. Argument 'cacheProfileIds': {cacheWheels}
    2006-02-10 12:58:50,031 DEBUG [org.springmodules.cache.provider.AbstractCacheProviderFacadeImpl] - Method 'getCacheProfile(String)'. Argument 'cacheProfileId': cacheWheels
    2006-02-10 12:58:50,031 DEBUG [org.springmodules.cache.provider.AbstractCacheProviderFacadeImpl] - Method 'getCacheProfile(String)'. Variable 'cacheProfile': [email protected][refreshPeriod=<null>,groups=<null>,cronExpression=<null>]
    2006-02-10 12:58:50,031 DEBUG [org.springmodules.cache.provider.AbstractCacheProviderFacadeImpl] - Method 'flushCache(String[])'. Cache flushed.
    2006-02-10 12:58:50,032 INFO [project.Dao.BaseDao] - Actualitzant la fase Calidad! per empresa 1
    2006-02-10 12:58:50,032 DEBUG [org.springframework.jdbc.core.JdbcTemplate] - Executing SQL update [ update hmFaseProduccion set hFaseProduccion=?, hOrdenEnProceso=?  where  CodigoEmpresa=? and hCodigoFaseProduccion=?]
    But a later call to "obtenirFasesProduccio" gets again the first cached value from the cache:

    2006-02-10 12:58:50,125 DEBUG [] - Initializing transaction synchronization
    2006-02-10 12:58:50,125 DEBUG [org.springmodules.cache.provider.AbstractCacheProviderFacadeImpl] - Method 'getFromCache(CacheKey, String)'. Argument 'cacheKey': 629|22072380
    2006-02-10 12:58:50,125 DEBUG [org.springmodules.cache.provider.AbstractCacheProviderFacadeImpl] - Method 'getCacheProfile(String)'. Argument 'cacheProfileId': cacheWheels
    2006-02-10 12:58:50,125 DEBUG [org.springmodules.cache.provider.AbstractCacheProviderFacadeImpl] - Method 'getCacheProfile(String)'. Variable 'cacheProfile': [email protected][refreshPeriod=<null>,groups=<null>,cronExpression=<null>]
    2006-02-10 12:58:50,126 DEBUG [com.opensymphony.oscache.base.algorithm.AbstractConcurrentReadCache] - get called (key=629|22072380)
    2006-02-10 12:58:50,126 DEBUG [org.springmodules.cache.provider.AbstractCacheProviderFacadeImpl] - Method 'getFromCache(CacheKey, String)'. Variable 'cachedObject': [[email protected], [email protected], [email protected], [email protected], [email protected], [email protected]]
    2006-02-10 12:58:50,126 DEBUG [org.springframework.transaction.interceptor.TransactionInterceptor] - Invoking commit for transaction on project.Logica.IMantenimentAppBl.obtenirFases
    Anyone is using OSCache with Spring ? Maybe I should try another cache impl ?


  • #2
    Hi all,

    Well, I simply changed from OSCache to JCS and everything is going well... I've lost the CronExpression feature though.



    • #3
      Then there might be an issue with OSCache. Post your problem on spring modules mailing list just in case - Alex, the maintainer, can probably help you out.