Custom Cache Providers
Extend the BoxCache your way!
Overview
Architecture Overview
Required Interfaces
ICacheProvider
public interface ICacheProvider {
// Configuration and lifecycle
ICacheProvider configure( CacheService cacheService, CacheConfig config );
void shutdown();
// Basic operations
Attempt<Object> get( String key );
void set( String key, Object value );
boolean clear( String key );
void clearAll();
// Bulk operations
IStruct get( String... keys );
void set( IStruct entries );
// Cache management
Array getKeys();
boolean lookup( String key );
int getSize();
void reap();
// Advanced operations
Object getOrSet( String key, Supplier<Object> provider );
CompletableFuture<Attempt<Object>> getAsync( String key );
// Statistics and reporting
ICacheStats getStats();
IStruct getStoreMetadataReport();
}ICacheStats
ICacheEntry
Step-by-Step Implementation Guide
Step 1: Create the Provider Class
Step 2: Implement Core Cache Operations
Step 3: Implement Bulk Operations
Step 4: Implement Advanced Features
Step 5: Implement Statistics and Reporting
Configuration
Provider Configuration
Configuration Properties
Registration
Best Practices
1. Error Handling
2. Serialization
3. Resource Management
4. Thread Safety
5. Performance Optimization
6. Statistics and Monitoring
7. Configuration Validation
Last updated
Was this helpful?
