Previously for redis when "invalidation" is enabled the referencesTTL is defaulted to the maximum ttl value from all the configuration values, this isn't possible with a dynamic ttl, as the function cannot be resolved until the function has been executed - for this scenario we use the maximum determinable ttl (if there is a least one static ttl defined) and where there are no static ttl option through an error stating that the referencesTTL option needs to be explicitly defined.
This includes some changes that were missing from #121 - namely policy level validation (and tests) plus the typings for stale - I can split this out into a separate pull request is required.
Adds support for defining a dynamic ttl via a function in the cache options. This leverages the existing support for a dynamic ttl in https://github.com/mcollina/async-cache-dedupe.
Previously for redis when "invalidation" is enabled the
referencesTTL
is defaulted to the maximumttl
value from all the configuration values, this isn't possible with a dynamic ttl, as the function cannot be resolved until the function has been executed - for this scenario we use the maximum determinable ttl (if there is a least one static ttl defined) and where there are no static ttl option through an error stating that thereferencesTTL
option needs to be explicitly defined.This includes some changes that were missing from #121 - namely policy level validation (and tests) plus the typings for
stale
- I can split this out into a separate pull request is required.closes #137
cc @simone-sanfratello