[Borges-users] more on caching

Eric Hodel drbrain at segment7.net
Sun Apr 11 22:06:06 EDT 2004


??????? ???????? (slepnev_v at rambler.ru) wrote:

> Hi,
> 
> 1) I'm attaching my LRUCache.
> 
> 2) Why doesn't Borges use WeakRef from standard Ruby? Things would be 
> easier. Will try to look into that.

WeakRef doesn't do what I need it to do.  I've stolen the guts of
WeakRef for use in Weak::Key.

Here's how Borges::StateRegistry is supposed to work:

Register object X with key N.

When key N goes out of scope, remove object X from the registry.

In order for key N to go out of scope, it must be weakly held.

In order for key N to remove object X from the registry, it must know
where the registry lives.

Its easier to steal the guts of WeakRef than to try to extend it,
since the finalizer must be rewritten to support removing objects from
the registry.

-- 
Eric Hodel - drbrain at segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/borges-users/attachments/20040411/f58546df/attachment.bin


More information about the Borges-users mailing list