[DGD] Self destructing keys

Felix A. Croes felix at dworkin.nl
Tue Aug 15 18:15:05 CEST 2006


Shentino <shentino at gmail.com> wrote:

> I remembered how mappings automatically clean out when an object key
> or value gets destructed...
>
> So I thought I'd try using "objects" as self-destructing keys for
> caching and stuff.
>
> I'd have some information X that caches Y.
>
> Now, I could arrange Y to destruct the "cache key" that X was using,
> and any stale data in X would automatically vanish.
>
> Anyone see any problems?
>
> My main concern is that while it works in theory, I might be
> cluttering up the driver's internal memory by leaving lots of orphaned
> data to garbage collect.

This should be a nice workout for the driver.  The main inefficiency
would be the overhead of using objects for such a purpose only (it
can't be done with light-weight objects), rather than the garbage
collection.

Regards,
Dworkin



More information about the DGD mailing list