Skip to content

Ability to add cache entries directly, bypassing the Lookup function #39

Open
@ithinkicancode

Description

@ithinkicancode

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions