LRU cache library for React Native, built on top of AsyncStorage v2 or an included MemoryStore, with automatic pruning of least recently used items. Current stable version is 2.0.3, released in 2020, with infrequent updates. It provides a simple key-value storage with TTL support and configurable max entries. Differentiators: designed specifically for React Native, uses AsyncStorage for persistence, includes MemoryStore for in-memo caching, and supports multiple namespaces. Alternatives like react-native-community/async-storage offer lower-level access but lack LRU behavior.
npm install react-native-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initializes an LRU cache with AsyncStorage backend, sets and gets a value, then removes it.
Update import to '@react-native-async-storage/async-storage' or use the new package name.
Always set maxEntries in the policy option.
Set stdTTL to the desired number of seconds or omit for default (unlimited).
Install @react-native-community/async-storage and import as: import AsyncStorage from '@react-native-community/async-storage'
Run 'npm install react-native-cache' and ensure import uses named import: import { Cache } from 'react-native-cache'Ensure AsyncStorage is correctly installed and imported, and linked for React Native < 0.60.