Results 1 to 6 of 6

Thread: @CacheFlush does not flush

  1. #1
    Join Date
    Jan 2006
    Location
    italy
    Posts
    55

    Default @CacheFlush does not flush

    Hi,
    every method annotated with @CacheFlush does not flush the cache
    I turned on debug for org.springmodules.cache and the flush is never called.
    i am using ehcache

    configuration is the following

    ehcache.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd">
    
    	<defaultCache
    		maxElementsInMemory="500"
    		eternal="true"
    		overflowToDisk="false"
    		memoryStoreEvictionPolicy="LFU" />
    
    	<cache name="i18NTextCache"
    		maxElementsInMemory="5000"
    		eternal="true"
    		overflowToDisk="false"
    		memoryStoreEvictionPolicy="LFU" />
    
    </ehcache>
    the cached and annotated dao is the following
    Code:
    ...
    import org.springmodules.cache.annotations.CacheFlush;
    import org.springmodules.cache.annotations.Cacheable;
    ...
    
    	@Cacheable(modelId = "i18NTextCacheModel")
    	public List<I18NText> loadAll() {
    
    		logger.debug("loadAll called");
    		...
    	}
    
    	@CacheFlush(modelId = "i18NTextFlushModel")
    	public Long save(I18NText entity) {
    
    		logger.debug("save called");
    		...
    	}
    }
    first execution of loadAll (db hit)
    Code:
    DEBUG [EhCacheFacade] Attempt to retrieve a cache entry using key <4267358|4266664> and cache model <org.springmodules.cache.provider.ehcache.EhCacheCachingModel@b9f82b[cacheName='i18NTextCache']>
    DEBUG [EhCacheFacade] Retrieved cache element <null>
    DEBUG [I18NTextDaoImpl] loadAll called
    INFO  [STDOUT] Hibernate: select ...
    DEBUG [EhCacheFacade] Attempt to store the object...
    execution of save (cache not flushed)
    Code:
    DEBUG [I18NTextDaoImpl] save called
    INFO  [STDOUT] Hibernate: update ...
    INFO  [STDOUT] Hibernate: insert ...
    and loadAll again (db not hit, cache used)
    Code:
    DEBUG [EhCacheFacade] Attempt to retrieve a cache entry using key <4267358|4266664> and cache model <org.springmodules.cache.provider.ehcache.EhCacheCachingModel@b9f82b[cacheName='i18NTextCache']>
    DEBUG [EhCacheFacade] Retrieved cache element ...

    any idea ?

    thanks
    Last edited by paolo_denti; Aug 21st, 2007 at 01:59 PM.
    Paolo Denti

  2. #2
    Join Date
    Jan 2006
    Location
    italy
    Posts
    55

    Default

    same problem even with the tonight snapshot of 0.9 version
    Paolo Denti

  3. #3
    Join Date
    Jan 2006
    Location
    italy
    Posts
    55

    Default

    no idea from anybody ?
    Paolo Denti

  4. #4
    Join Date
    Apr 2008
    Posts
    15

    Default @CacheFlush Still failing

    Hello

    Was this issue ever resolved? Every method I annotate with @CacheFlush doesn't ever flush the cache. @Cacheable works fine.

    Thanks

    Mark

  5. #5
    Join Date
    Jan 2006
    Location
    italy
    Posts
    55

    Default

    Quote Originally Posted by markandirene View Post
    Hello

    Was this issue ever resolved? Every method I annotate with @CacheFlush doesn't ever flush the cache. @Cacheable works fine.

    Thanks

    Mark
    i don't think so ... i simply avoided to use the cache modules.
    anyway, no answer for such a big "what looks a bug" looks very strange.
    Paolo Denti

  6. #6

    Default Can you post your spring configuration..

    Can the spring cache configuration be posted? (Also, you might want to annotate the interface class, not the actual implementation class, sometimes that fixes it).

    Also, within Spring-Modules search for RShelley post with the title "Declarative Caching" (I can't post links yet). It has a lot of useful information on setting up.
    Last edited by joshr; Oct 8th, 2008 at 03:42 PM.

Posting Permissions

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