In an e-commerce application, the user has saved product filters with Push To Cache. Before the user applies the filters, the Check Key Existence action checks whether the filters are in the cache. This ensures that the Fetch From Cache or Remove From Cache actions only work with valid keys.
Step-by-step usage
- Filter Key Check
- When the user arrives at the product list page, the system checks whether the user_123_filters key is in the cache with Check Key Existence.
- Running the Check Key Existence Action
- It is added as an OnClick action to the page load or button click event.
- Parameters
- Cache Key: user_123_filters
- Next Actions
- If the key does not exist: A warning such as “Save filters first” can be displayed to the user, or default values can be applied.
- Testing and Validation
- Web: The existence of the key is verified with the EXISTS user_123_filters command in Redis CLI.
- Mobile: The existence or absence of the key is tested in InMemory cache preview mode.