Skip to content

v0.1.0

Latest
Compare
Choose a tag to compare
@joseph0926 joseph0926 released this 24 Oct 00:01
da0fc8e

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 or sessionStorage
  • ⏱️ 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 between localStorage or sessionStorage
  • ttl: Set expiration time in milliseconds
  • encryptionKey: Enable AES-GCM encryption
  • compression: Enable data compression
  • validateOnLoad: Enable data integrity checks
  • maxSize: Set maximum storage size
  • staleWhileRevalidate: Configure stale data handling
  • namespace: Set custom namespace for keys
  • onError: Custom error handling
  • serialize/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.