[hibernate-dev] API to clear/evict all caches in a session factory

Steve Ebersole steve at hibernate.org
Wed Feb 22 11:11:00 EST 2012


Well one reason would be to trigger clearing of the update-timestamps 
cache.  I am leery of exposing a method to allow just that 
fuinctionality.

On Wed 22 Feb 2012 10:00:43 AM CST, Steve Ebersole wrote:
> There is already:
> sf.getCache().evictEntityRegions()
> sf.getCache().evictCollectionRegions()
> sf.getCache().evictDefaultQueryRegion()
> sf.getCache().evictQueryRegions()
>
> I can see a benefit to having evictQueryRegions() imply 
> evictDefaultQueryRegion()
>
> But, I fail to see a real benefit to a singular 
> sf.getCache().oneEvictionToRuleThemAll()
>
> On Wed 22 Feb 2012 09:49:35 AM CST, Galder Zamarreño wrote:
>> Hi all,
>>
>> Re: http://java.dzone.com/tips/clearing-hibernate-second-leve
>> Re: https://community.jboss.org/message/718710#718710
>>
>> Shouldn't Hibernate offer an API (independent of the cache provider) 
>> to clear all 2LC caches, including all entity, all collection and all 
>> query/timestamp caches?
>>
>> Beneath it, each cache provider would implement this as it wishes to 
>> do so, but the knowledge of all caches within a session factory is in 
>> Hibernate core itself.
>>
>> Cheers,
>> -- 
>> Galder Zamarreño
>> Sr. Software Engineer
>> Infinispan, JBoss Cache
>>
>>
>> _______________________________________________
>> hibernate-dev mailing list
>> hibernate-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>

-- 
steve at hibernate.org
http://hibernate.org



More information about the hibernate-dev mailing list