From: "Shot (Piotr Szotkowski)" Date: 2008-02-20T16:01:35+09:00 Subject: Re: Object#freeze as a basis for caching of method results? --dycUMCmLTP6kl/eW Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Ezra Zygmuntowicz: > The usual idiom for caching heavy results is something like this: > def foo > @foo ||=3D some_long_calculation > end Thanks. I=E2=80=99m aware of the ||=3D construct, but it doesn=E2=80=99t re= ally answer the bigger issue of how to handle cache freshness (see my original email). Basically, I was wondering whether freezing can be (sanely) used to make sure we don=E2=80=99t have =E2=80=98stale=E2=80=99 cache (in a bit of a rev= erse/radical way =E2=80=93 by freezing the object when we do *any* caching). Alternatively, does the approach of invalidating a cache on object-changing method calls make sense? If so, is there a way to get all the methods that change an object (say, a Set) =E2=80=93 i.e., the ones that would trigger the =E2=80=98TypeError: can't modify frozen X= =E2=80=99 exception? -- Shot --=20 Transitiveness works a bit differently in love. "I love A, and A loves B, which means I want to make a light snack out of B's internal organs." -- Alistair Young --dycUMCmLTP6kl/eW Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQFHu8dji/mCfdEo8UoRAh91AJ0X7R6q2sq1xGpNE4gqvyD5TevcrACgrrll 0dR12l2tkBdxWc7C/6WmIHc= =0CjU -----END PGP SIGNATURE----- --dycUMCmLTP6kl/eW--