Skip to content

`RedisActionCache`: Store `ActionResult` value

Santiago Gil requested to merge santigl/redis-inline-actionresult into master

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) or EntryType.ACTION_RESULT.
  • update_action_result(): write the serialized message selected by the entry_type parameter
  • get_action_result(): if present, parse the serialized ActionResult from Redis instead of reading it from storage. If the value read is not of entry_type and migrate_entries is enabled, update the entry.

Issues addressed

Addresses part of #350 (closed)

Edited by Santiago Gil

Merge request reports