[Borges-users] and some more on caching

Eric Hodel drbrain at segment7.net
Sun Apr 11 23:04:25 EDT 2004


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

> I guess the problem with caching isn't the weak hash. 
> 
> My sample application is now just a tab panel. I've implemented it in 
> two ways. The first way: when the user clicks a tab, the instance 
> variable selected_tab is changed. (This has to be registered for 
> backtracking.)

I think this should grow to a certain size then remain stable.

> The second way: when the user clicks a tab, the controller calls a new
> delegate. (No registering for backtracking - it isn't needed.)

Per your other messages, this sounds like it should grow unbounded,
unless #will_answer? returns false.

> Both hog the memory.
> 
> P.S. I can't understand the weak identity key hash. Why are the keys 
> weak references, and not the values?

The weak identity key hash is used by StateRegistry.

The StateRegistry is storing past states for the objects registered into
it.

When a registered object disappears, all of its past state is no
longer necessary.

The key is a reference to the original object, so when the original
object goes out of scope, its state will be automatically deleted.

-- 
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/be6887e0/attachment.bin


More information about the Borges-users mailing list