Talent-Catalog / talentcatalog

https://tctalent.org
GNU Affero General Public License v3.0
9 stars 4 forks source link

Implement a mechanism for Redis cache flushing #1138

Open sadatmalik opened 1 month ago

sadatmalik commented 1 month ago

User Story: As an admin, I sometimes need to update the database directly. This can lead to inconsistencies with Redis cached entries. Therefore, I need a way to manually flush the Redis cache to ensure data consistency.

Problem: Currently, there is no direct method to purge the Redis cache from the AWS console. Flushing the cache must be done via the Redis console or AWS Systems Manager (SSM).

Objective: Investigate available options and implement a repeatable, easy-to-use method for manually purging the Redis cache when necessary. Document the process.

Tasks:

sadatmalik commented 1 month ago

Opting to implement as a system admin API call for cleaner security access. Longer term it is better to introduce the Amazon service manager to manage cloud services.

From the TC admin api:

Screenshot 2024-07-05 at 13.18.48.png

Before and after in Redis:

Screenshot 2024-07-05 at 13.19.41.png
sadatmalik commented 2 weeks ago

Pre and post flush_user_cache:

Screenshot 2024-07-16 at 15.46.48.png
sadatmalik commented 2 weeks ago

Applied as a hot fix to prod - and tested to be working:

Screenshot 2024-07-16 at 16.19.57.png

Redis entries after flushing users cache:

Screenshot 2024-07-16 at 16.21.32.png
sadatmalik commented 2 weeks ago

Documented step by step instructions for usage here: https://app.tettra.co/teams/talentbeyondboundaries/pages/recurring-tc-processes#header-76mk0-flushing-the-tc-redis-cache