In-memory cache implementation for development and testing.
Features:
Suitable for:
NOT suitable for:
In-memory cache implementation for development and testing. Features: - Thread-safe operations using Clojure atoms - TTL support with automatic expiration - LRU eviction policy - Statistics tracking - Pattern matching - Namespace support Suitable for: - Local development without Redis - Fast unit testing - CI/CD pipelines - Single-process applications NOT suitable for: - Distributed systems (not shared across processes) - Production use (no persistence) - High-memory workloads (limited by JVM heap)
(clear-all! cache)Clear all cache entries and statistics. Useful for testing.
Args: cache - InMemoryCache instance
Clear all cache entries and statistics. Useful for testing. Args: cache - InMemoryCache instance
(create-in-memory-cache)(create-in-memory-cache config)Create in-memory cache instance.
Args: config - Optional configuration map: :default-ttl - Default TTL in seconds :max-size - Maximum number of entries (LRU eviction) :track-stats? - Track hit/miss statistics (default true)
Returns: InMemoryCache instance implementing all cache protocols
Create in-memory cache instance.
Args:
config - Optional configuration map:
:default-ttl - Default TTL in seconds
:max-size - Maximum number of entries (LRU eviction)
:track-stats? - Track hit/miss statistics (default true)
Returns:
InMemoryCache instance implementing all cache protocols(get-all-entries cache)Get all cache entries. Useful for testing.
Args: cache - InMemoryCache instance
Returns: Map of key -> CacheEntry
Get all cache entries. Useful for testing. Args: cache - InMemoryCache instance Returns: Map of key -> CacheEntry
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |