Tuesday, March 14, 2006

A smarter cache

The code for cache has been completely redone. It is nested-transaction aware, purging updated cached items (cachables) when a transaction aborts.

Another big change is the use of a double-linked list. When you access an item, it is moved to the end of the list. (As before, when adding an item to the list, the oldest item is removed from the list.) Most significantly, now you can call clear on a cachable item and it is cleaned up and ready to go back into the pool of available objects as soon as its reference count drops to zero.

Holding a reference count on an item then no longer prevents the item from being cleared. This simplifies things and happens to work with the way the Ark uses cached items.

Bill

0 Comments:

Post a Comment

<< Home