Release Notes
Version 0.1.0 (2024-10-24)
We are excited to announce the initial release of Client Cache Query, a powerful client-side state management library for React applications. This release introduces a comprehensive set of features for managing persistent client state with advanced caching mechanisms.
✨ Key Features
Core Functionality
- 🔄 Persistent state management across page reloads using
localStorage
orsessionStorage
- ⏱️ Time To Live (TTL) support for automatic state expiration
- 🔄 Cross-tab synchronization using Storage Event API
- 💾 Memory caching layer for improved performance
- 🔄 Stale-while-revalidate pattern support
Security & Data Integrity
- 🔐 AES-GCM encryption for sensitive data
- 🔍 Hash-based data integrity validation
- 📦 Data compression support
- 📏 Storage size limits and management
Developer Experience
- 📝 Full TypeScript support with comprehensive type definitions
- 🎯 Simple and intuitive API inspired by React Query
- 🛠️ Customizable serialization and deserialization
- 🚨 Comprehensive error handling system
- 🏷️ Namespace support for preventing key collisions
📚 API Overview
const [state, setState] = useClientCache<T>(
key: string,
initialValue: T,
options?: UseClientCacheOptions<T>
);
🔧 Configuration Options
storage
: Choose betweenlocalStorage
orsessionStorage
ttl
: Set expiration time in millisecondsencryptionKey
: Enable AES-GCM encryptioncompression
: Enable data compressionvalidateOnLoad
: Enable data integrity checksmaxSize
: Set maximum storage sizestaleWhileRevalidate
: Configure stale data handlingnamespace
: Set custom namespace for keysonError
: Custom error handlingserialize
/deserialize
: Custom data transformation
🔍 Technical Details
Storage Management
- Efficient memory caching implementation
- Automatic cleanup of expired items
- Storage size monitoring and management
- Cross-tab synchronization mechanism
Security Features
- AES-GCM encryption implementation
- Data integrity verification using hashing
- Safe error handling and fallbacks
Performance Optimizations
- In-memory caching layer
- Compressed data storage
- Efficient state updates
- Optimized cross-tab communication
💻 Server-Side Rendering
- Full SSR compatibility
- Graceful fallback in non-browser environments
- Hydration support
🐛 Known Issues
- Large data sets might experience slight performance degradation when compression is enabled
- Cross-tab synchronization might have a small delay in some browsers
- Encryption features require secure key management implementation by the user
📋 Requirements
- React 16.8+ (Hooks support required)
- TypeScript 4.0+ (for TypeScript users)
- Modern browser support (ES2017+)
🔜 Upcoming Features
- IndexedDB support for larger storage capacity
- Background sync capabilities
- Batch operations support
- Advanced prefetching mechanisms
- Enhanced debugging tools
- Custom storage adapter support
📝 Documentation
Full documentation is available in the README.md file, including:
- Detailed API reference
- Usage examples
- Configuration options
- Best practices
- TypeScript usage
- Security considerations
🙏 Acknowledgments
This library was inspired by React Query and builds upon modern web storage APIs and encryption standards. Special thanks to the React community for valuable insights and patterns.
🔄 Migration Guide
As this is the initial release, no migration is necessary. Future releases will include detailed migration guides when needed.
📜 License
This project is licensed under the MIT License - see the LICENSE file for details.
For more information, please visit our GitHub repository or check out the documentation.
To report issues or contribute, please visit our Issues page.