Caching Engineering Notes

cache_dict

Caching: cache_dict and similar (buffer). No code should update the cache directly (Applies to in system or in manual scripts). Instead, update the source of Truth (eg database), then regenerate the cache.

Advanced special case: Inside a system level thing (not script):

For performance optimization in special cases, you might be able to update the “in memory” state and serialize from there directly to the cache. Annotation update does this. This requires a lot more assumptions - so think extra critically if it’s viable and implemented correctly. Then also get extra code review done if this is needed.