Make reactive caching clean up after itself
What does this MR do?
Let ReactiveCache cleanup unused keys in Redis
-
Redis Cache keys are expired after 2 weeks. ReactiveCaching keys should not live that long unless their object has requested it.
-
ReactiveCaching creates 2 keys per stored value - one that just stores a boolean true value (the
:alive
key) and one that stores the value. The:alive
key that stores the boolean true is set to expire afterreactive_cache_lifetime
expires. -
ReactiveCaching spawns ReactiveCachingWorker to update/create the value as needed.
-
if the
:alive
key is present when ReactiveCachingWorker executes the value key is updated / created. -
if the
:alive
key is NOT present, this change will cause the value key to be deleted and release the memory consumed in Redis for the key and value. -
There is no way for the value key to be re-used if the
:alive
key has expired. If the:alive
key has expired, a Rails.cache.delete is called for both keys
Screenshots
Does this MR meet the acceptance criteria?
Conformity
- [-] Changelog entry
- [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
If objects are calculating renegade keys instead of using ReactiveCaching, then that might be a problem.
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [-] Label as security and @ mention
@gitlab-com/gl-security/appsec
- [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- [-] Security reports checked/validated by a reviewer from the AppSec team