Cache conflict in Redis for Get Flags and Get Identities endpoints in the Flagsmith API #5001
Open
1 of 4 tasks
Labels
bug
Something isn't working
How are you running Flagsmith
Describe the bug
A cache issue occurs in the Get Flags and Get Identities endpoints of the Flagsmith API when using Redis for caching, configured as described in the official documentation.
The keys saved in Redis do not include the api_key as part of the key attributes, causing cache overwrites and response conflicts between different API calls.
Upon analyzing the code, it seems that the cache controller is overwriting the cache keys in Redis. The current structure of the Redis keys is as follows:
This results in inconsistent responses.
Example of the Issue
API_KEY_1 makes a request to the Get Flags endpoint and saves a response in Redis.
API_KEY_2 (different project) makes a request to the same endpoint but receives the response saved by API_KEY_1.
Steps To Reproduce
Expected behavior
Screenshots
API_KEY_1:
API_KEY_2 (different project) with cache:
API_KEY_2 no cache:
The text was updated successfully, but these errors were encountered: