Custom Cache Strategy

Learn how to implement custom persistence backends (e.g. Redis, WebWorker, IndexedDB LRU, or BroadcastChannel) by extending ACacheProvider and registering them via CacheProviderFactory.

🛠️ Step-by-Step Custom Driver Setup

Katlux allows you to plug any custom caching driver into RequestProvider and data providers without modifying core toolkit code.

  • 1. Subclass ACacheProvider: Implement the standard contract (get, set, remove, removeByPrefix, getKeyList, getRemainingTime, cleanupExpired).
  • 2. Register with CacheProviderFactory: Use CacheProviderFactory.registerDriver() with an async dynamic loader for optimal tree-shaking, or pass the class directly.
  • 3. Use Anywhere: Pass your strategy name directly to RequestProvider, CAPIFlatServerDataProvider, or fetch it via CacheProviderFactory.getProvider().