memo accepts an argument 'key' which
specifies the keying strategy.
digest_key computes a key by hashing the contents of the object using
the digest package. No attempt is made to avoid MD5 hash collisions.
pointer_key strategy uses object identity,
that is, pointer equivalence. This can be faster because hte
entire object need not be hashed. However, this strategy is only
useful when the function is called repeatedly on the same
object rather than merely identical objects. Also be aware that
the cache will hold on to the values of the arguments, to prevent
them being garbage collected.
hybrid_key strategy first tries to key on object
identity and then falls back on computing the md5 digest.
This may use two cache slots per result.
1 2 3 4 5
A function whose results should be cached.
A cache object.
A digest function to use.
A memoized function.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.