| Author |
Message |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 03/24/2011 11:29:29
|
namratag
master
Joined: 01/31/2011 06:38:45
Messages: 98
Offline
|
Hello,
We are using open source license version of Terracotta in our web application for caching.
I have hibernate second level cache defined as follows:
<cache eternal="false" maxElementsInMemory="2000" name="com.zong.Client_Pricepoint" memoryStoreEvictionPolicy="LRU" timeToLiveSeconds="7200" statistics="true">
<terracotta synchronousWrites="false" localKeyCache="true" localKeyCacheSize="2000" />
</cache>
This cache is being used for the database table called client_pricepoint.
Here is how the cache is being used in hibernate hbm file:
<cache usage="nonstrict-read-write" region="com.zong.Client_Pricepoint" />
The problem is that, if the contents of Client_Pricepoint table changes manually, i.e. if i add/remove a row from the table directly in the database then i need to forcefully flush this cache.
I tried clearing the cache contents of the hibernate cache com.zong.Client_Pricepoint from the dev console and in the statistics dev console shows In_Memory = 0 , On-Disk = 0 but i still see old rows in my application.
My question is,
Do i need to anything else to clear the cache contents other than clearing it through dev console?
Thanks,
Namrata
|
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 03/24/2011 15:04:11
|
steve
ophanim
Joined: 05/24/2006 14:22:53
Messages: 619
Offline
|
That should work. What version of Terracotta are you using? Are you seeing any other strange behavior?
|
Want to post to this forum? Join the Terracotta Community |
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 03/24/2011 15:27:33
|
namratag
master
Joined: 01/31/2011 06:38:45
Messages: 98
Offline
|
I am using terracotta version 3.4.0.
No other strange behavior other than cache clearance is not working as expected.
Thanks,
Namrata
|
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 03/24/2011 17:02:40
|
gkeim
ophanim
Joined: 12/05/2006 10:22:37
Messages: 685
Location: Terracotta, Inc.
Offline
|
What do you mean by "but i still see old rows in my application. "? Are you expecting the DB table to be cleared when the associated Hibernate 2nd-level cache is cleared?
|
Gary Keim (terracotta developer) Want to post to this forum? Join the Terracotta Community |
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 03/24/2011 17:53:49
|
namratag
master
Joined: 01/31/2011 06:38:45
Messages: 98
Offline
|
ofcourse not :-)
Here is the scenario:
1. Web application loads the data from the DB table and that data is cached using hibernate second level cache with following settings.
<cache eternal="false" maxElementsInMemory="2000" name="com.zong.Client_Pricepoint" memoryStoreEvictionPolicy="LRU" timeToLiveSeconds="7200" statistics="true">
<terracotta synchronousWrites="false" localKeyCache="true" localKeyCacheSize="2000" />
</cache>
2. Now I manually delete 1 row from that database table using a sql query.
3. Web application still shows all the rows (including the deleted row) from that table because the data is being loaded from cache instead of making a DB request.
4. now, i go to developer console and clear the contents of the cache com.zong.Client_Pricepoint.
Since i cleared the cache from dev console, what I expect is that, next time when i load my application , it should not show the row that was deleted because cache was cleared and the row does not exist in the DB.
But that does not seem to be the case. i.e. flushing the cache from terracotta dev console does not seem to force the web application to load the data from DB. Only after I wait 2 hours (which is the expiration time of my cache above), i see that the deleted row is no longer present on the web application.
Hope this clarifies.
|
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 04/07/2011 15:39:09
|
teck
seraphim
Joined: 05/24/2006 15:03:25
Messages: 1099
Offline
|
I wouldn't want to rule out the possibility of a bug here. Your steps seems sane to me.
Any chance you could create a test application that we can run to see if we can reproduce the same behavior?
If nothing else you can file this a bug if you wish (http://jira.terracotta.org/)
|
Tim Eck (terracotta engineer)
|
|
|
 |
|
|