(Background: thinking about caching and syncing order key value stores)

Tracking Cached Data

Now is the more challenging part — keeping track of what data is in the cache so we know if we can fulfill the request locally or not.

Example, suppose we've fetched this result and stored it in the cache:

list({gte: a, lte: b})

Example, when we fetch data without two-sided bounds, then we don't know the data range up-front. Instead, we need to wait for the results before we store the data range.

list({limit: 10}) -> [a, ..., b]

Cache Eviction

Next, we need to think about how cache eviction works.

When we request data from the cache, we also subscribe to it. But these ranges aren't the same:

the subscription is the the args, and the cached range has to do with both the args and the

resulting data.

Lets walk through an example.

cached: