Description
Motivation
In some scenarios, we might want to add a value to the cache directly without calling the lookup function. An example of such business logic is we have some special values that don't exist in the database (from which the lookup function retrieves values), nonetheless we want to serve these special values by injecting them directly into the cache.
Considerations
The decision to bypass lookup is most likely determined by some external conditions. Currently the Lookup
function has the following signature:
def lookup(key: Key): ZIO[Environment, Error, Value]
And this function is provided upfront during the construction of the cache, when the conditions to bypass might not be available.
We'd probably either need to express the conditions and the value to add through Environment
, or need to add additional (optional) parameters to the lookup
function.