Remix Client Cache screenshot

Remix Client Cache

Author Avatar Theme by Forge 42
Updated: 27 Apr 2025
245 Stars

Utility library to cache your client data in Remix.run

Categories

Overview

remix-client-cache is a remarkable library designed specifically for Remix.run, providing an efficient way to cache server loader data on the client side through clientLoaders. This library smartly adopts a stale-while-revalidate strategy, ensuring that you have immediate access to stale data while fetching the latest information in the background. It’s particularly useful for developers looking to improve application performance by efficiently managing server data without complex setups.

Its versatility allows for cache invalidation on specific keys, offering granular control over what gets cached. With first-party support for popular storage options such as localStorage and sessionStorage, remix-client-cache fits seamlessly into your development workflow. The ability to create custom cache adapters further enhances its utility, making it an exceptional choice for React developers using the Remix framework.

Features

  • Stale While Revalidate Strategy: Automatically serves stale data while fetching fresh data in the background, improving performance and user experience.

  • Cache Invalidation: Allows you to invalidate cached data selectively for specific keys or multiple keys, giving you fine-tuned control over your cache.

  • Flexible Cache Adapters: Supports custom cache adapters, enabling advanced use cases beyond the built-in in-memory storage.

  • Global and Per Route Configuration: Use the configureGlobalCache for a global adapter or create specific ones with createCacheAdapter for individual routes.

  • ClientLoader Integration: Easily integrate cacheLoaderData with your components, using the clientLoader export for efficient data handling.

  • Storage Support: First-party compatibility with localStorage, sessionStorage, and localforage, allowing quick and easy configuration for various storage options.

  • Promise-Based API: Implements a promise-based API for cache management, making it intuitive to use with modern JavaScript and asynchronous operations.

  • Customizable Interface: Implement the CacheAdapter interface for tailored caching solutions that meet your specific project needs.