Advanced cache content access
Overview
The cache works with three parameters which constitute a cache key - KEY:NAMESPACE:SCOPE
Currently, in order to get values from the Cache, you have to pass such triplet and a unique Cache entry will be returned, matching this key.
Add new functionality to allow clients to pass multiple scopes (array) to the Cache service, so that it can retrieve multiple cache entries with a single request. For example, to query the cache in this way, the request could specify KEY, NAMESPACE, [SCOPE1, SCOPE2] and the Cache service will make a lookup for each triplet and will combine the results in a single JSON response.
Example sequence diagram showing a strategy where both queries to the cache return the same results (the same key), and are flattened with a merge all strategy:
sequenceDiagram
Client ->> Cache: Query: KEY1: NS1: [ SCOPE1,SCOPE2 ]
Cache ->> Redis: get KEY1:NS1:SCOPE1
Redis ->> Cache: {"hello":"world"}
Cache ->> Redis: get KEY1:NS1:SCOPE2
Redis ->> Cache: {"hello":"africa"}
Cache ->> Cache: now the cache has two values and must flatten them
Cache ->> Cache: Flatten Strategy? first, last, merge all
Cache ->> Client: {"hello_1":"world","hello_2":"africa"}
note left of Cache: example of "merge all" strategy