History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: NHCH-1
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: Al Priest
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
NHibernate.Caches

SysCache re-caches items without expiration policy

Created: 22/May/06 08:50 AM   Updated: 12/Jul/08 02:41 PM
Component/s: SysCache/SysCache2
Affects Version/s: 1.2.1GA
Fix Version/s: None

File Attachments: 1. Zip Archive Syscache.zip (2 kb)



 Description  « Hide
Hi,

Following on from [url=http://forum.hibernate.org/viewtopic.php?t=959404&highlight=softquerycache]my post[/url] which was causing an ever growing amount of memory in NHibernate when using HQL queries, I have found two bugs in the SysCache implementation. I have written and tested a patch for SysCache which fixes these:

1) When an item is placed into the cache, if it does not already exist it is added with an expiration policy. If the item does exist, it is placed into the cache without an expiration policy - this means that the item lives until the garbage collector decides to remove it. I have modified the Put method so that if the key is already contained in the cache, it is removed and the new item can be inserted with an expiration policy.

2) When an item was being overwritten in the cache (Cache[key]=value) it caused the callback to fire which would delete the _map reference to the key. As the item was then being added into the cache, this meant the _map set of keys would not be synchronised. I've changed this to use cache dependancies:- when the cache is created a root cache node is created which all items in the cache become dependant upon. When the Clear method is called it removes the root cache node, causing all dependant cache items to be removed. This removes the requirement for the Hashtable _map which contained a list of all keys added by the cache instance.

I've attached the unit test and patch for both issues.

Al

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Sergey Koshcheyev - 22/May/06 08:55 AM
Thanks, I'll take a look at it.

Sergey Koshcheyev - 02/Jun/06 07:37 AM
Reopening to fix in 1.0.3

Sergey Koshcheyev - 31/Jul/06 02:18 AM
Fixed in 1.0.3