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:
...the idea is to cache results from "obtenirTotesFasesProduccio", and flush before executing "actualitzarFase" in "baseDaoTarget".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>
I've enable debugging:
The first call gets cached:
Later, a call to "actualitzarFase" generates the following log (so the cache seems to be cleared):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
But a later call to "obtenirFasesProduccio" gets again the first cached value from the cache: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=?]
Anyone is using OSCache with Spring ? Maybe I should try another cache impl ?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
Regards,
Esteve


