How square/ttcache works
Main Components
a) Core Components:
• TTCache Main Service
• Tag Management System
• Store Layer
• Return Directive System
b) Storage Implementations:
• Memcached Store
• Sharded Memcached Store
• Tagged Store
┌─ Application Layer ─────────────────────────────────────┐
• ┌─ Client Code ─┐ │
• Controllers │ │
• Middleware │ │
• ┘ │
• ↓ │
• ┌─ TTCache Core ──────────────────────────────┐ │
• ┌─ Tag Management ─┐ ┌─ Cache Control ─┐ │ │
• TagNode │ │ - Remember │ │ │
• TaggedValue │ │ - Load │ │ │
• TaggingKey │ │ - Clear │ │ │
• ┘ └───────────────┘ │ │
• ↓ ↓ │ │
• ┌─ Tag Types ────┐ ┌─ Results ────┐ │ │
• HeritableTag │ │ - LoadResult │ │ │
• ShardingTag │ │ - StoreResult│ │ │
• ┘ └──────────────┘ │ │
• ┘ │
• ↓ │
• ┌─ Store Layer ────────────────────────────┐ │
• ┌─ Store Implementations ─┐ │ │
• MemcachedStore │ │ │
• ShardedMemcachedStore│ Interface │ │
• TaggedStore │ │ │
• ┘ │ │
• ┘ │
• ┘
Important Relationships to Highlight
a) Tag Tree Structure:
• How tags form a hierarchical structure
• How HeritableTag and ShardingTag extend the base tag system
• Demonstrate tag propagation through the cache hierarchy
b) Storage Layer:
• Relationship between different store implementations
• How the storage interface is implemented by different stores
• Connection between TaggedStore and other store implementations
Implementation Details
• Tag inheritance mechanism
• Sharding implementation
• Cache key generation and management
• Memory preloading functionality
• Error handling and result wrapping
Notes
• Keep the main TTCache interface simple but show its powerful recursive capabilities
• Tag tree structure as it's the core concept
• How the caching system integrates with different storage backends
• Flexibility of the tagging system