Distributed cache using Redis and memoization with TTL expiry and LRU pruning