Results 1 to 3 of 3

Thread: Cache not flushed

  1. #1
    Join Date
    Jan 2005
    Posts
    15

    Default 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:

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

    I've enable debugging:

    The first call gets cached:
    Code:
    2006-02-10 12:58:43,818 DEBUG [org.springframework.transaction.support.TransactionSynchronizationManager] - 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': org.springmodules.cache.provider.oscache.OsCacheProfile@190b03c[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):

    Code:
    2006-02-10 12:58:50,031 DEBUG [org.springframework.transaction.support.TransactionSynchronizationManager] - 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': org.springmodules.cache.provider.oscache.OsCacheProfile@190b03c[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:

    Code:
    2006-02-10 12:58:50,125 DEBUG [org.springframework.transaction.support.TransactionSynchronizationManager] - 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': org.springmodules.cache.provider.oscache.OsCacheProfile@190b03c[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': [project.Beans.Fase@1b5c3de, project.Beans.Fase@4e6138, project.Beans.Fase@1d0c37d, project.Beans.Fase@d2499a, project.Beans.Fase@1de3994, project.Beans.Fase@9637fe]
    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 ?

    Regards,
    Esteve

  2. #2
    Join Date
    Jan 2005
    Posts
    15

    Default

    Hi all,

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

    Regards,
    Esteve

  3. #3
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    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.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •