durusmail: durus-users: Moving cache from object count to size
Moving cache from object count to size
2010-09-24
2011-03-15
Moving cache from object count to size
Jesus Cea
2011-03-15
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 16/01/11 22:44, Neil Schemenauer wrote:
> Jesus Cea  wrote:
>> I have objects 50 bytes long, and 60Kbytes long :-(. I would
>> suggest to change the cache code to control cache size, instead of
>> object count.
>
> I played with this idea a little.  It seems like the bookkeeping
> will get pretty complicated.  Iterating over all objects in the
> cache to find the current size does not seem feasible, for
> performance reasons.  Therefore, the cache would have to keep track
> of the total size as objects are added and removed.  The fact that
> objects are weakly referenced by the cache futher complicates
> things.
>
> Maybe I'm missing a simple implementation but it doesn't appear to
> be worth the effort, IMHO.

You have the weak reference callback, for instance. It is not different
to current cache object count.

- --
Jesus Cea Avion                         _/_/      _/_/_/        _/_/_/
jcea@jcea.es - http://www.jcea.es/     _/_/    _/_/  _/_/    _/_/  _/_/
jabber / xmpp:jcea@jabber.org         _/_/    _/_/          _/_/_/_/_/
..                              _/_/  _/_/    _/_/          _/_/  _/_/
"Things are not so easy"      _/_/  _/_/    _/_/  _/_/    _/_/  _/_/
"My name is Dump, Core Dump"   _/_/_/        _/_/_/      _/_/  _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQCVAwUBTX+3Y5lgi5GaxT1NAQKZnAP+LJM0JeSnjLiAa0pxx+zRaziPh2d2S0ss
n5daZmogs9IzjWs2qp0p8rZnymACniJWDb2GEDLyYfdDFvc73OP/R1hh2ngmfHVI
8c5+etJwWwgsoOdvxJgx1K2dM+wskBN31Q+GLnFcIw8Ve5rPU83HEoyM5ASAYaO5
KDtOAzdYw5E=
=CFUt
-----END PGP SIGNATURE-----
reply