InterviewStack.io LogoInterviewStack.io

Caching Strategies and In Memory Storage Questions

Caching strategies for improving performance and reducing latency: HTTP caching semantics (Cache-Control, ETag, conditional requests, Vary), application-level caching with Redis and Memcached, in-memory data structures for caching, cache eviction policies (LRU, LFU, FIFO), cache invalidation strategies, TTL selection and trade-offs, and the consistency and performance implications of deciding what and when to cache.

MediumTechnical
49 practiced
Implement a thread-safe memoization decorator in Python that caches function results with a TTL per key. Explain how you handle race conditions when multiple callers compute the same expired value, and provide example usage demonstrating caching and expiry behavior.
HardTechnical
62 practiced
Design a low-latency in-memory cache for fraud detection rules with requirements: read latency <2ms, updates must propagate and take effect globally within 500ms, and emergency rule revokes must be immediate. Explain architecture for distribution, propagation, ordering, atomicity of updates, and how to handle rollbacks/consistency.
HardTechnical
58 practiced
Implement a consistent hashing ring in Python that maps arbitrary keys to a set of nodes and supports add_node(node) and remove_node(node) with minimal remapping. Use virtual nodes to improve balance. Provide code outline, explain complexity, and show sample usage mapping keys to hosts.
MediumTechnical
56 practiced
Explain Redis persistence modes (RDB snapshots vs AOF append-only file). For a cache that must occasionally persist important session state, describe which persistence modes or combinations you would enable and why. Discuss performance, durability, restart recovery time, and potential impact on latency.
HardTechnical
58 practiced
You have 100 million keys with average JSON value of 1KB in Redis and memory pressure is causing frequent evictions. Describe concrete strategies to reduce memory footprint: changing serialization format, using hashes to pack fields, value compression, policy tuning, offloading cold items to a disk-based store (e.g., RocksDB), and choosing appropriate memory allocators.

Unlock Full Question Bank

Get access to hundreds of Caching Strategies and In Memory Storage interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.