Cache-Memcached-Turnstile
view release on metacpan or search on metacpan
of key/expiration pairs. "compute_cb" receives an extra, third,
parameter as compared to the single-key implementation: A references to
an array containing the keys for which values need to be computed. (This
list of keys is possibly only a subset of the original set of keys.) The
callback needs to return a reference to an array of values which
correspond to the computed values for each input key in turn.
The "wait" parameter works fundamentally the same as in the single-key
function, but the callback variant also receives a third parameter: The
list of keys whose values weren't available from the cache and couldn't
be locked for computation. The callback is expected to return a hash
reference of keys and values. This is different from the "compute_cb"
interface to allow for easy calling back into
"multi_cache_get_or_compute" for retries (see the "wait" example for the
single-key implementation above).
As with the single-key variant, "compute_time" is the additional
cached-value life time for a single value, so should at least be an
upper bound (or slightly more) on the computation-time for a single key.
Alas, there is a trade-off here: Since the implementation seeks to limit
the number of roundtrips as much as possible, it will pass all
lib/Cache/Memcached/Turnstile.pm view on Meta::CPAN
key/expiration pairs. C<compute_cb> receives an extra, third, parameter
as compared to the single-key implementation: A references to an array
containing the keys for which values need to be computed. (This list of
keys is possibly only a subset of the original set of keys.) The callback
needs to return a reference to an array of values which correspond to the
computed values for each input key in turn.
The C<wait> parameter works fundamentally the same as in the single-key function,
but the callback variant also receives a third parameter:
The list of keys whose values weren't available from the cache and couldn't be
locked for computation. The callback is expected to return a hash reference
of keys and values. This is different from the C<compute_cb> interface
to allow for easy calling back into C<multi_cache_get_or_compute> for retries
(see the C<wait> example for the single-key implementation above).
As with the single-key variant, C<compute_time> is the additional
cached-value life time for a single value, so should at least be an upper bound
(or slightly more) on the computation-time for a single key.
Alas, there is a trade-off here: Since the implementation seeks to
limit the number of roundtrips as much as possible, it will
pass all keys-to-be-computed to one run of the C<compute_cb>.
( run in 0.526 second using v1.01-cache-2.11-cpan-49f99fa48dc )