`RedisActionCache`: Store `ActionResult` value
Before raising this MR, consider whether the following are required, and complete if so:
-
Unit tests [ ] Metrics-
Documentation update(s)
If not required, please explain in brief why not.
These are changes in implementation details that are transparent to users of the RedisActionCache
class.
Description
Currently, the RedisActionCache
class stores pairs that contain the serialized Digest
of the ActionResult
as their value. When querying the cache, it parses that Digest
and fetches the corresponding ActionResult
from the underlying storage.
This adds an option to make entries contain the ActionResult
itself. That way the ActionResult
can be read directly from the entry in Redis and a fetch from the storage avoided.
The method that carries out the actual read from Redis will always check the type of the entry in order to maintain compatibility with caches that were populated by another instance with a different configuration.
A migrate-entries
option can make RedisActionCache
convert the format of old entries to the new type as they are accessed.
Changes proposed in this merge request:
- Change constructor to receive an
EntryType
:EntryType.ACTION_RESULT_DIGEST
(default) orEntryType.ACTION_RESULT
. -
update_action_result()
: write the serialized message selected by theentry_type
parameter -
get_action_result()
: if present, parse the serializedActionResult
from Redis instead of reading it fromstorage
. If the value read is not ofentry_type
andmigrate_entries
is enabled, update the entry.
Issues addressed
Addresses part of #350 (closed)