User Manual

Remove From Cache

Remove From Cache

Remove From Cache allows you to delete data previously added to the cache on the Kuika platform using the specified key. If the specified key does not exist in the cache or has been previously deleted, the action returns the error “Given key does not exist.” This action allows you to clean up unnecessary or outdated data from the cache, thereby maintaining application performance and data integrity. Supported cache providers are Redis and Memory, each of which is managed through the Configuration Manager.

This action can be used in both web and mobile applications. For Redis usage, users can perform cache operations through their own instances by providing their own connection strings. When InMemory is selected, values are deleted when the application is closed.

Remove From Cache Action Steps

  1. Action Definition
    • Open your project on the Kuika platform.
  • Click the Add Action button on the right side and select the Remove From Cache action.
  1. Cache Key Determination
  • Specify the key of the data to be deleted.
  • Example: user_123_filters
  1. Using the Cache Provider
    • The cache provider must be the same as the provider where the data is stored (InMemory and Redis).
    • Example: Redis for web applications, InMemory for mobile applications.
  2. Running and Testing the Action
    • Verify that the deletion was successful.
    • If you are using Redis, you can check whether the key has been deleted by running the command redis-cli -h localhost -p 6379 in the terminal. However, this depends on how Redis is configured. This method will work if the Redis service is active on the server where the generated application is running.

Important Points

  • If the key is not found in the cache or has been previously deleted, the action returns the error “Given key does not exist.”
  • The key to be deleted must have been previously added with Push To Cache or Fetch From Cache.
  • The cache provider must be the same as the provider where the data is stored; otherwise, the deletion will not occur.
  • When InMemory is selected, the data is already lost when the application is closed.

Remove From Cache Usage Scenario: Clearing E-Commerce Product Filters

Scenario: In an e-commerce application, the user has previously saved product filters with Push To Cache. However, they now want to clear the old filters. With the Remove From Cache action, these filters are deleted from the cache, and subsequent Fetch From Cache operations cannot return data from this key.

Step-by-Step Usage

  1. Clearing User Filters
    • After applying the user filters, the user clicks the “Clear Filters” button.
  2. Executing the Remove From Cache Action
    • Remove From Cache is added to this button as an OnClick action.
  3. Parameters
    • Cache Key: user_123_filters
  4. Cache Provider
    • Redis was selected for the web application, and the user connected their own Redis Instance from Configuration Manager.
    • InMemory was selected for the mobile application; values will be deleted when the application is closed.
  5. Data Deletion
    • The Remove From Cache action deletes the specified cache key and related data from the selected cache provider.
  6. Use in Other Actions
    • The key that could previously be used with Fetch From Cache is no longer valid.
    • Example: Even if the user opens the “Saved Filters” panel, the user_123_filters key will not be found and the filters will not be loaded into the form fields.
  7. Testing and Verification
    • Web: Verify that the key has been deleted with the KEYS * and GET user_123_filters commands in Redis CLI.
    • Mobile: Test that the data has been deleted by running the action in InMemory cache preview mode.

Remove From Cache Action Advanced Customizations

  • Conditional Deletion: Data can be deleted based on specific user roles or screen states.
  • Batch Deletion: The action can be designed to delete multiple keys at the same time.
  • Error Management: If the deletion fails, a custom error message can be displayed to the user.

Technical Risks

  • Duplicate Key Usage: If the same key is used in different actions, the deletion may affect all related data.
  • Connection String Errors: Redis will fail if the connection string is entered incorrectly.
  • Unexpected Deletion: If the wrong key is specified, important data may be lost.
  • Beta Risks: Redis or other providers may behave differently in preview and test environments.

Other Related Content

No items found.

Glossary

No items found.

Alt Başlıklar