Closed kpdecker closed 9 years ago
The issue is not setting the generateFunc per key, but specifying it later, after Policy construction.
Closing in favor of #111
I don't think #111 fixes the issue described here. In our use case we do need to provide custom generateFunc
on per key basis. In order to do that using new policy.rules()
method introduced in #111, we would have to call it before every policy.get()
call, which seems like an extremely bad idea. Besides, to preserve other rules we would have to do something like policy.rules(_.extend(policy.rule, {generateFunc: newFunc}))
, but policy.rule
is not part of public API, and it's not strictly speaking the same as options
(there is compile
call involved https://github.com/hapijs/catbox/blob/master/lib/policy.js#L34), so we are making unsafe assumptions here.
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
After the
get
andgetOrGenerate
functionality were merged, it's impossible to provide a per-record generator. For situations where the policy is intended to be a grab bag of data and is not constructed by the consumer, this makes the cache unusable.