What should you prepare for Caching and Redis interviews?
Where should I start?
Start with cache design, which appeared in 26 of 114 interviews. Questions cover more than what Redis is. Check whether you can describe where you would use a cache and how you would manage its data.
- Can you explain when caching is worth using and when you would choose Redis?
- Which Redis data structures and commands would you use?
- What would your cache keys contain, and how would you fill the cache?
- When would entries expire, and what would happen after a database update?
- How would you test invalidation and keep protected content away from unauthorized users?
What code should I be ready to write?
Coding tasks appeared in 7 of 114 interviews. The LRU cache task with O(1) get and put operations appeared in 5 of 114 interviews. Can you build it with a hash map and a linked list, rather than just name those structures?
- What does your getter do when it retrieves an entry?
- How does
puthandle an existing key? - What happens at the capacity limit, and how do you update the linked list?
- How would you make an in-memory cache thread-safe?
Also check whether you can code an application cache for repeated requests with the same input and output. This was another task in these interviews.
What should I check for frontend or mobile work?
Frontend and mobile caching appeared in 22 of 114 interviews. Check client caching as well as Redis.
Can you avoid duplicate requests, explain GraphQL normalization, and describe when a framework revalidates cached data? For mobile apps, can you handle offline data and image caching?
For HTTP caching, can you identify cacheable requests and explain Cache-Control and ETag? Can you trace stale content through browser caches and CDNs after an asset update or deployment rollback?
How would I check a cache in production?
Can you verify that caching works and say how you would measure its effectiveness? Check whether you can size resources, diagnose Redis memory pressure, and prevent cache stampedes. If Redis fails, how would you recover it or fill it again?
For distributed design, choose a use case covered in these interviews: sessions, rate limiting, idempotency, likes, chat, or messaging. What would Redis do in that design? If data changes across services, how would you keep those updates reliable?
Who gets asked Caching and Redis
The 20 most asked Caching and Redis questions
Counted by interview, not by mention: a question asked twice in one conversation counts once.
What is Redis, and how would you use it in an application?
Asked in 5 of 114 interviews · last asked Oct 12 · Tooling · Junior
Show answer
Redis is a fast, in-memory data store that supports structures like strings, hashes, and lists. I would use it to cache frequently read data, store sessions, or track rate limits. For caching, the application checks Redis first, reads the database on a miss, and caches the result with an expiry time.
- Caching reduces database work and response time, but cached data can become stale.
- Set expiry times and update or remove cached values when source data changes.
- Redis can persist data to disk, but durability depends on configuration.
- Plan for memory limits and Redis failures; a cache should not be the only copy of important data.
What the interviewer checks: The interviewer checks whether you understand Redis, its common uses, and basic cache trade-offs.
Other ways it was asked
- “How can Redis be used in an application?”
- “What is Redis, and how is it used in networked applications?”
- “What is Redis, and why do we need to use it in our application?”
How would you design and implement application caching, and when would you use Redis?
Asked in 5 of 114 interviews · last asked Oct 12 · Concept · Mid-level
Show answer
I would cache frequently read data that is slow to fetch and can tolerate some staleness. With cache-aside, the app checks the cache, then loads and caches missing data with a TTL. I would invalidate affected entries after writes. I would use Redis when multiple app instances need a shared, fast cache.
- Choose cache keys that include relevant user, tenant, and query details to prevent incorrect results or data leaks.
- Set TTLs based on acceptable staleness, and limit memory use with an eviction policy.
- Handle cache failures safely, and prevent many requests from rebuilding the same missing entry at once.
- Measure cache hit rate, response time, and database load to check whether caching helps.
What the interviewer checks: The interviewer checks whether you can improve speed while managing stale data, shared access, and cache failures.
Other ways it was asked
- “How would you implement caching in an application, and when would you use it?”
- “How would you implement caching in an application?”
- “How would you design a caching strategy, including how you would use Redis?”
How would you implement an LRU cache with O(1) get and put operations?
Asked in 5 of 114 interviews · last asked Sep 10 · Write code · Mid-level
Show answer
Use a hash map and a doubly linked list. The map finds entries, and the list tracks which entry was used least recently. Each successful get or put moves the entry to the most recent end; when full, inserting a new key evicts the least recent entry. Operations take O(1) average time because hash lookups are average O(1).
- Each cached key maps to exactly one list node; cache size never exceeds capacity.
- Successful reads and updates both refresh recency.
- List moves and removals take O(1); space usage is O(capacity).
- Python's OrderedDict supports this design; the example returns -1 for misses and handles zero capacity.
Pythonfrom collections import OrderedDict class LRUCache: def __init__(self, capacity): self.capacity, self.items = max(0, capacity), OrderedDict() def get(self, key): if key not in self.items: return -1 self.items.move_to_end(key) return self.items[key] def put(self, key, value): self.items[key] = value; self.items.move_to_end(key) if len(self.items) > self.capacity: self.items.popitem(last=False)What the interviewer checks: The interviewer checks whether you can combine fast lookup with correct recency tracking and eviction without scanning entries.
Other ways it was asked
- “How would you design and implement an LRU cache?”
- “Design and implement an LRU cache with get(key) and put(key, value) operations.”
- “Design an LRU cache with get(key) and put(key, value) operations that run in O(1) time.”
What is caching, and where is it used in an application?
Asked in 4 of 114 interviews · last asked Oct 12 · Concept · Junior
Show answer
Caching stores a copy of data or a computed result so later requests can reuse it faster. Applications use caches in browsers, CDNs, application memory, or shared stores like Redis. A cache hit returns the saved value; a cache miss requires fetching or computing it. Cached data can become stale, so it needs expiration or updates.
- Use caching for frequently read data or expensive work that can be reused.
- Caching reduces response time and load on databases or other services.
- Caches use extra storage and need rules for keeping data fresh.
What the interviewer checks: The interviewer checks whether you understand cache hits, cache misses, common cache locations, and the risk of stale data.
Other ways it was asked
- “What is caching, and how does it work?”
- “What is caching, and when would you use it?”
- “What is caching?”
How would you keep cached data synchronized with database updates?
Asked in 3 of 114 interviews · last asked Oct 14 · Scenario · Mid-level
Show answer
I would update the database first, then delete the affected cache entries after the transaction commits. The next read would load fresh data from the database and cache it again. I would also set a TTL and retry failed cache deletions, because database writes and cache changes are not one atomic operation.
- Invalidate every affected cache entry, including cached lists or search results.
- Use reliable retries or durable update events if cache deletion fails.
- Concurrent reads can cache old data again; invalidation alone does not guarantee consistency.
- TTL limits staleness, but does not make updates immediately visible.
What the interviewer checks: The interviewer checks whether you handle normal updates, failed invalidation, and races without promising perfect consistency.
Other ways it was asked
- “How would you keep a cache synchronized with a database?”
- “What should happen if a student's name changes in the database while a caching layer still contains the old name?”
- “If you add a cache like Redis in front of the database for get user by ID, what rules would you use to keep cached data from going stale after updates?”
How would you verify that caching works and measure its effectiveness?
Asked in 3 of 114 interviews · last asked Sep 22 · Scenario · Mid-level
Show answer
I would test cache misses, hits, expiry, and invalidation, and check that returned data is correct. Then I would compare realistic workloads with and without caching. I would track hit rate, request latency, database load, cache errors, memory use, and evictions to confirm that caching helps without serving unacceptably stale data.
- Verify repeated reads use the cache, and updates or expiry refresh data as designed.
- Measure hit rate as hits divided by hits plus misses, ideally per cached operation.
- Compare cold and warm caches under similar load; check median and tail latency and database queries.
- Monitor memory, evictions, and errors; a high hit rate alone does not prove better performance.
What the interviewer checks: The interviewer is checking whether you can verify cache correctness and measure real benefits for the workload.
Other ways it was asked
- “How would you ensure your cache is working correctly, and what metrics would you monitor?”
- “How can you monitor cache usage and gain insight into it within an application?”
- “How would you determine whether caching is effective for this workload and how do you measure it?”
How would you cache protected content without serving it to unauthorized users?
Asked in 2 of 114 interviews · last asked Jul 16 · Scenario · Senior
Show answer
Check who the user is and whether they still have access before serving protected content, even on cache hits. Bypass shared page and CDN caches unless access is checked before every cached response. Use `Cache-Control: private, no-store` for protected responses. Cache objects internally, but check access before returning them and separate user-specific data.
- A cache key or an unguessable URL is not an access check.
- CDN rules must respect cache headers and must not override them for protected responses.
- Include user or tenant identity in cache keys when the content differs by user or tenant.
- Invalidate cached access decisions when permissions change; a TTL alone leaves a window for revoked access.
What the interviewer checks: The interviewer is checking whether caching can bypass access checks or leak content across users.
Other ways it was asked
- “How should you handle caching when users should only see content they have purchased or been granted access to?”
- “How would you configure page caching, a CDN, and object caching so protected membership pages are never served to the wrong user?”
How would you flush or selectively invalidate cached data in an application using Redis?
Asked in 2 of 114 interviews · last asked Jul 20 · Design · Senior
Show answer
I invalidate specific Redis keys with DEL after the database update commits. For groups of keys, I use SCAN with an application prefix, then delete matches. FLUSHDB clears the selected Redis database; FLUSHALL clears all databases on that server. I use TTLs as a backup to limit how long stale data remains.
- Use application prefixes to avoid deleting another application's keys.
- Prefer SCAN over KEYS in production; KEYS can block Redis on large datasets.
- Avoid flushing shared databases: flush commands remove more than just your application's cache.
- Scanning and deleting is not atomic; concurrent requests can recreate stale entries.
What the interviewer checks: The interviewer checks whether you can invalidate the right data without blocking Redis or deleting unrelated data.
Other ways it was asked
- “How would you flush or invalidate an application's cache?”
- “How would you control cache invalidation in Redis?”
How should LRU put handle existing keys, capacity limits, and linked-list updates?
Asked in 2 of 114 interviews · last asked Aug 13 · Write code · Senior
Show answer
For an existing key, replace its value and move its node to the most recently used end without changing the size. For a new key, add a node and a map entry. If capacity is exceeded, remove the least recently used node from both the list and the map.
- Reuse an existing node; do not create duplicates or evict another key when updating.
- When unlinking, connect the previous node to the next node in both directions.
- When inserting, set both node links and neighboring links; update head or tail if not using sentinels.
- A cache with zero capacity must keep no entries.
What the interviewer checks: The interviewer checks whether you preserve recency order, capacity, and agreement between the map and linked list.
Other ways it was asked
- “In a bounded LRU cache, what should the setter do when adding or updating an entry?”
- “When setting a value in an LRU cache, how should you handle a key that already exists?”
- “When implementing an LRU cache, how do you handle put(key, value) when the key already exists versus when capacity is exceeded, and what pointer updates are required?”
How does HTTP caching work, which requests are cacheable, and how do Cache-Control and ETag affect it?
Asked in 2 of 114 interviews · last asked Oct 7 · Concept · Mid-level
Show answer
HTTP caches store responses and reuse them while they are fresh. GET and HEAD are usually cacheable, but storage also depends on response headers and status. Cache-Control sets storage and freshness rules. ETag identifies a response version; the client sends it in If-None-Match, and a 304 Not Modified response lets it reuse the cached body.
- max-age sets freshness in seconds; stale responses generally need validation or replacement.
- no-cache allows storage but requires validation before reuse; no-store forbids storage.
- private prevents shared-cache storage; public allows shared caches, such as CDNs, to store responses.
- POST caching requires explicit freshness and Content-Location matching the request URL; support is uncommon.
What the interviewer checks: The interviewer checks whether you distinguish cache storage, freshness, and validation, rather than assuming every request is cached.
Other ways it was asked
- “How does client-side HTTP caching work, and are all requests cached?”
- “How does HTTP caching work with `Cache-Control` and `ETag`?”
How do you fetch, cache, and refresh server data with React Query or SWR?
Asked in 2 of 114 interviews · last asked Sep 7 · Tooling · Mid-level
Show answer
React Query and SWR fetch server data through hooks and cache it by key. I provide a key and fetch function, then handle loading and error states. They can refresh data in the background. After changes, I invalidate affected React Query queries or use SWR’s mutate to update or refresh cached data.
- Include filters, page numbers, and other request inputs in the cache key.
- In React Query, staleTime controls freshness; stale data is not immediately deleted.
- Refresh on window focus, reconnect, or an interval is configurable; defaults differ between libraries.
- Make the fetch function throw on failed HTTP responses so the hook can report errors.
What the interviewer checks: The interviewer checks whether you can manage cached server data and keep it fresh after changes.
Other ways it was asked
- “How do you manage server state with React Query and SWR?”
- “How do you fetch, cache, and reload API responses with React Query?”
How do you persist and unpersist cached data in Spark or Databricks?
Asked in 2 of 114 interviews · last asked Aug 19 · Tooling · Mid-level
Show answer
Use cache() or persist() to cache a Spark DataFrame or RDD on executors. Caching is lazy: an action computes and stores the data. Use persist() to choose a storage level, then call unpersist() when the cached data is no longer needed.
- Cache data you will reuse; caching adds storage and computation costs.
- Storage levels control whether cached data uses memory, disk, or both.
- Default storage levels differ between DataFrames, RDDs, APIs, and Spark versions.
- unpersist() removes cached blocks, not source data; blocking=True waits for removal in PySpark.
Pythonfrom pyspark import StorageLevel df = spark.table("events").persist(StorageLevel.MEMORY_AND_DISK) try: print(df.count()) # Computes and caches the data. print(df.filter("event_type = 'click'").count()) finally: df.unpersist(blocking=True)What the interviewer checks: The interviewer is checking whether you understand lazy caching, storage choices, reuse, and cleanup.
Other ways it was asked
- “How do you persist a data structure on a Spark worker and unpersist it after the operation?”
- “How do you cache a DataFrame in Databricks, and how do you manage its lifecycle?”
What types of cache are available in Snowflake, and how do they work?
Asked in 2 of 114 interviews · last asked Sep 22 · Concept · Mid-level
Show answer
Snowflake has three main cache types: query result, warehouse data, and metadata. The result cache stores query results for 24 hours and can reuse them for eligible queries. Each warehouse caches data it reads on local SSD storage. The metadata cache holds table information and statistics, which can answer some queries without scanning data.
- Result reuse generally requires a matching query, unchanged source data, and valid permissions.
- The result cache is separate from warehouses, so reuse can avoid running a warehouse.
- Warehouse data caching speeds up later reads; suspending the warehouse loses this cache.
- Metadata is managed by cloud services and can support operations such as simple row counts.
What the interviewer checks: The interviewer checks whether you distinguish cached results, cached data, and metadata, including when each avoids work.
Other ways it was asked
- “What is caching in Snowflake, and how many types of caching are there?”
What is KV caching, and how does it work in LLM inference?
Asked in 2 of 114 interviews · last asked Oct 6 · Concept · Mid-level
Show answer
KV caching stores attention keys and values for tokens an LLM has already processed. Each new token attends using cached keys and values plus its own, which are also cached. This avoids recomputation for earlier tokens. This speeds up generation but uses more memory as the context grows.
- Processing the prompt fills the cache; generating tokens extends it.
- Each attention layer keeps its own cached keys and values.
- Attention over earlier tokens still runs; caching does not remove that work.
- Longer contexts and more simultaneous requests increase cache memory use.
What the interviewer checks: The interviewer checks whether you understand what attention reuses and the speed-versus-memory trade-off.
Other ways it was asked
- “Can you explain the KV cache?”
What should your application do when Redis becomes unavailable?
Asked in 2 of 114 interviews · last asked Sep 6 · Scenario · Senior
Show answer
If Redis is only a cache, the application can read from the database, but it must limit fallback traffic. Use short timeouts and a circuit breaker to stop repeated Redis calls. Serve stale data when safe, or reject excess requests. If Redis holds sessions, locks, or other critical state, reject affected operations rather than bypass required checks.
- Cache failures can degrade performance; failures involving critical state may require rejecting requests.
- Limit database fallback traffic to prevent overload.
- Bound retries and add delays with jitter to avoid a retry storm.
- After recovery, handle missed invalidations and refill the cache gradually.
What the interviewer checks: The interviewer checks whether you can preserve correctness and prevent a Redis outage from overloading other services.
Other ways it was asked
- “What should a system do if Redis goes down?”
- “Redis goes down briefly—what are your failure mode options, and how do you keep the system safe?”
How would you design a distributed Redis rate limiter that handles race conditions, window choices, and outages?
Asked in 2 of 114 interviews · last asked Sep 9 · Design · Senior
Show answer
I would use one Redis key per user, shared by all servers, with a sliding window allowing 100 requests in any 60 seconds. A Lua script checks and updates the limit atomically. Fixed windows use less memory but allow bursts across boundaries. During outages, I would reject requests for strict limits or use a weaker local fallback.
- Sliding window script: ZREMRANGEBYSCORE removes expired entries; ZCARD checks usage; ZADD records allowed requests; PEXPIRE handles cleanup.
- Use Redis TIME for timestamps and unique request IDs as sorted-set members to avoid merging requests.
- For fixed windows, run INCR and conditional EXPIRE together in Lua; separate calls risk missing expiry.
- Redis failover can lose recent writes; strict limits need stronger consistency or conservative rejection.
What the interviewer checks: The interviewer checks whether you can enforce shared limits atomically and explain window accuracy and outage trade-offs.
Other ways it was asked
- “How would you implement a distributed rate limiter using Redis or another store, and what exact atomic operations would you rely on to avoid race conditions?”
- “Design a rate limiter that allows each user to make at most 100 requests per minute. Can it support multiple servers, handle Redis outages and race conditions, and choose between fixed and sliding windows?”
Where would you store a selected team identifier—in a cache or in cookies?
Asked once · last asked Sep 7 · Scenario · Mid-level
Show answer
I would store the selected team ID in a cookie if the server needs it, or local storage for browser-only use. A server-side cache can store it in a session, but it may be evicted. The server must check that the user can access the selected team.
- Cookies are sent automatically with matching requests; local storage values are not.
- Treat the stored ID as a preference, not proof of access.
- Use a database if the selection must persist across devices.
- A cache should not be the only copy of a preference that must survive eviction.
What the interviewer checks: The interviewer checks whether you separate user preferences from access control and choose storage based on how it is used.
Other ways it was asked
- “Where would you store a selected team identifier: in a cache, cookies, or local storage?”
What is the difference between a cache and a Java Map, and when would you use each?
Asked once · last asked Apr 23 · Concept · Junior
Show answer
A Java Map stores key-value pairs; a cache stores reusable data to avoid slow or costly work. Caches often add expiry and automatic removal when full. Use a Map for data your code manages directly, and a cache for data you can reload or calculate again.
- The Map interface does not require expiry, size limits, or thread safety.
- A cache can run inside your application or in a separate service, such as Redis.
- Cache entries may be missing or outdated; handle misses and decide how to keep data fresh.
What the interviewer checks: The interviewer checks whether you understand storage versus caching, including entry removal and handling missing or outdated data.
How can caching improve a website's performance?
Asked once · last asked Jun 5 · Concept · Mid-level
Show answer
Caching improves website performance by reusing stored data or content instead of fetching or creating it again. This makes responses faster and reduces work for servers and databases. Cached content must be refreshed or removed when it becomes outdated.
- Browser and CDN caches can serve files without contacting the main server.
- Application caches, such as Redis, can avoid repeated database queries or expensive calculations.
- Cache hits usually respond faster; cache misses require fetching or creating the requested content.
- Expiration and cache invalidation help limit outdated content.
What the interviewer checks: The interviewer is checking whether you understand how caching reduces repeated work and why keeping cached content fresh matters.
When addressing a performance problem, how would you decide between using Redis, optimizing SQL queries, or changing the data model?
Asked once · last asked Sep 18 · Scenario · Senior
Show answer
I would measure where the time goes before choosing a fix. I would optimize SQL for slow queries or missing indexes, and change the data model if its structure makes common operations expensive. I would use Redis for repeated reads when some stale data is acceptable, with a clear plan to keep the cache current.
- Use query plans and realistic load tests to find the bottleneck and verify improvements.
- Fix inefficient queries before adding a cache that introduces more moving parts.
- Data model changes can speed reads but add migration work or make writes more expensive.
- Redis adds memory costs and needs a freshness strategy and a plan for cache misses.
What the interviewer checks: The interviewer is checking whether you use measurements and weigh trade-offs instead of treating Redis as a universal fix.
Caching basics interview questions
Start with cache benefits, TTLs, storage layers, CPU caches, cookies, maps, and when caching is worth using. 14 questions.
What is a dirty cache?
Asked once · last asked Mar 6 · Concept · Mid-level
How can query caching improve response times?
Asked once · last asked Apr 23 · Concept · Mid-level
When should caching be used?
Asked once · last asked Jun 18 · Concept · Junior
How do caches and cookies differ in purpose, lifespan, storage, and security?
Asked once · last asked Aug 27 · Concept · Junior
Other ways it was asked
- “What is the difference between a cache and a cookie?”
- “How do caches and cookies differ in their lifespan, security, and client-side storage?”
What tool or technology would you use for caching?
Asked once · last asked Sep 13 · Concept · Mid-level
Why might you cache queries rather than their results?
Asked once · last asked Sep 22 · Concept · Mid-level
Other ways it was asked
- “Why are we caching queries instead of results?”
What does TTL (time to live) mean in computing, and where is it used?
Asked once · last asked Sep 28 · Concept · Junior
What is the purpose of memory located inside or near the CPU?
Asked once · last asked Sep 29 · Concept · Junior
What data is cached by default in a web application?
Asked once · last asked Oct 12 · Concept · Junior
Redis basics and data structures interview questions
Explore how Redis stores data, which commands and data structures to choose, how to organize keys, and how other stores compare. 9 questions.
Can Redis be used for publish-subscribe, or is it only for caching?
Asked once · last asked Jan 28 · Concept · Mid-level
When would you choose MongoDB over Redis, and what workloads suit each?
Asked once · last asked Feb 23 · Scenario · Mid-level
Other ways it was asked
- “How would you justify choosing MongoDB over Redis for an application?”
- “What kinds of tasks are MongoDB and Redis each suited for?”
Why might you use Redis INCR to generate IDs instead of relying on a database primary key?
Asked once · last asked Mar 19 · Concept · Mid-level
Other ways it was asked
- “When using Redis INCR to generate an ID, should you generate the ID before saving the record to the database?”
What are some Redis best practices, including rules for naming keys?
Asked once · last asked Apr 18 · Concept · Mid-level
How do you organize data in Redis, and where is it stored?
Asked once · last asked May 25 · Concept · Mid-level
When might Redis improve system performance, and what trade-offs would you consider before adopting it?
Asked once · last asked Jun 3 · Scenario · Senior
How would you use Redis to solve the N-Queens problem?
Asked once · last asked Aug 13 · Scenario · Mid-level
What Redis commands or data structures would you use beyond basic GET/SET operations, and when would you choose them?
Asked once · last asked Mar 19 · Tooling · Mid-level
Other ways it was asked
- “What Redis commands or data structures can you use to retrieve data besides GET and SET, and when would you choose them?”
Cache design and invalidation interview questions
Work through cache keys, ways to fill a cache, expiration, database updates, access rules, and invalidation tests. 29 questions.
When writing data that must appear in both a cache and a database, which should receive the initial write?
Asked once · last asked Mar 16 · Design · Senior
Other ways it was asked
- “When writing data to both a cache and a database, which should receive the initial write?”
How would you handle atomicity when updating both a cache and a database?
Asked once · last asked Mar 16 · Design · Senior
Other ways it was asked
- “How can you make an operation that updates both a cache and a database atomic?”
How could you generalize an application-level cache for use across multiple APIs or endpoints?
Asked once · last asked Jul 27 · Design · Senior
How would you keep cached data up to date across multiple application instances when one instance changes it?
Asked once · last asked Jan 28 · Scenario · Senior
How would you decide when to invalidate cached data and ensure data consistency without putting too much load on the system?
Asked once · last asked Mar 25 · Scenario · Senior
Other ways it was asked
- “How did you decide when to invalidate the cache data and ensure data consistency without putting too much load on the system?”
For a high-traffic endpoint that returns a list with nested relations, how do you decide between eager loading more data and introducing caching to reduce load? What do you cache: the full response, per-model data, or query results?
Asked once · last asked May 5 · Design · Senior
How would you design a caching layer for a frequently accessed product catalog in a back-end service? How would you decide what data to cache and handle cache invalidation to maintain data consistency?
Asked once · last asked May 8 · Design · Senior
How would you implement caching for a website, using plugins or other approaches?
Asked once · last asked Jun 5 · Scenario · Mid-level
How would you address cache invalidation and validation challenges in an application?
Asked once · last asked Jul 5 · Scenario · Senior
How would you structure a testing process to verify cache invalidation?
Asked once · last asked Jul 5 · Scenario · Mid-level
Other ways it was asked
- “What tests would you run to verify that cache invalidation is working as expected?”
- “How would you structure a cache invalidation validation process, and what key stages would it include?”
How would you fix a slow API when many requests have the same inputs and return the same output?
Asked once · last asked Jul 27 · Scenario · Mid-level
How would you code a simple application-level cache for repeated requests with the same input and output?
Asked once · last asked Jul 27 · Write code · Mid-level
Show 13 more
Beyond testing, what would you do to make an application-level cache production-ready?
Asked once · last asked Jul 27 · Scenario · Senior
What concerns would you consider when constructing cache keys for an application-level API cache?
Asked once · last asked Jul 27 · Scenario · Mid-level
How would you choose between Redis and local in-memory storage for feature flags?
Asked once · last asked Jul 29 · Design · Mid-level
Other ways it was asked
- “What drove the decision to use Redis versus in-memory storage for feature flags?”
How would you identify, track, and cache popular search queries?
Asked once · last asked Sep 13 · Scenario · Senior
When there is a cache issue or inconsistency, how would you resolve that situation?
Asked once · last asked Sep 15 · Scenario · Mid-level
What is cache invalidation, and when would you use it?
Asked once · last asked Sep 15 · Concept · Mid-level
When authorization decisions use a separate source of permissions, how would you design caching—including cache keys, TTLs, and invalidation—to reduce latency without serving stale access after a permission change?
Asked once · last asked Sep 16 · Design · Senior
For a user whose available menus depend on their role, would you check permissions in the database on every request or cache them?
Asked once · last asked Sep 21 · Scenario · Mid-level
How would you design a backend architecture that handles a user request through database access, caching, and response generation?
Asked once · last asked Sep 22 · Design · Mid-level
When a commerce application uses Redis and PostgreSQL, what data should be cached in Redis, and which data should remain authoritative in PostgreSQL?
Asked once · last asked Oct 5 · Design · Mid-level
How would you define cache keys and invalidation so a price or product image update is not stale for the user?
Asked once · last asked Oct 23 · Scenario · Senior
What would populate the Redis cache?
Asked once · last asked Jul 20 · Design · Mid-level
How would you track the longest time-to-live among cached entries?
Asked once · last asked Jul 20 · Design · Senior
LRU cache and eviction interview questions
Check eviction policies and caches with size limits, including hash maps, linked lists, thread safety, and handling concurrent requests. 16 questions.
Given that some cache responses are large, and recently used or recently added entries tend to be used again soon, what cache eviction approach makes sense?
Asked once · last asked Jul 27 · Scenario · Mid-level
Other ways it was asked
- “Given limited cache capacity, some large responses, and a pattern where recently used or added entries are likely to be used again soon, what cache eviction approach would you use to keep good performance?”
Implement a thread-safe in-memory cache storing companies with names and candidates with passport numbers and scores; generate unique integer company IDs, support company lookup by ID, efficiently find all candidates by passport number, and update a candidate's score within a specified company.
Asked once · last asked Mar 6 · Write code · Senior
Other ways it was asked
- “Implement a thread-safe in-memory cache for recruiting companies. Each company has a name and candidates, and each candidate has a passport number and score. Generate a unique integer ID when storing a company, support lookup by ID, index candidates by passport number, and allow a candidate's score to be updated within a specified company.”
How would you design a thread-safe collection structure for a company-and-candidate cache, and what should a passport-number index map to to support future updates?
Asked once · last asked Mar 6 · Design · Senior
If a cache's store method does not overwrite existing entries, how could two threads still change stored data, and which parts of the stored object could be mutable?
Asked once · last asked Mar 6 · Scenario · Senior
How would you design a thread-safe O(1) LRU cache and choose its locking strategy?
Asked once · last asked Mar 16 · Design · Senior
Other ways it was asked
- “How would you design a thread-safe LRU cache that supports `get(key)` and `put(key, value)` in O(1) average time? What core data structures would you combine, and what would need locking?”
- “How would you make the LRU cache thread-safe while maintaining good throughput under high concurrency—for example, what locking strategy and granularity would you use, and how would you avoid map/list inconsistencies?”
How would you handle contention and improve throughput in a concurrent LRU cache—for example, with sharding, segmented LRU, per-node locks, or approximations—and what correctness trade-offs would you accept?
Asked once · last asked Mar 16 · Design · Senior
When a cache is full, how does its eviction policy decide which data to remove?
Asked once · last asked Apr 15 · Concept · Mid-level
How would you keep the cache efficient when entries need to be evicted and the cache has limited size?
Asked once · last asked Jul 27 · Scenario · Mid-level
In an LRU cache, what should the getter do when retrieving an entry?
Asked once · last asked Jul 27 · Write code · Mid-level
Design an in-memory, thread-safe cache using an LRU or LFU eviction policy.
Asked once · last asked Aug 10 · Design · Senior
When an LRU cache exceeds its capacity, which node do you evict, and how do you remove it from both the linked list and hash map while keeping the list well formed?
Asked once · last asked Aug 13 · Write code · Senior
Why would you use hash maps and a doubly linked list to implement an LRU cache?
Asked once · last asked Sep 9 · Concept · Mid-level
Other ways it was asked
- “Why are you using hash maps and a doubly linked list for the LRU cache?”
Show 2 more
How would you choose a Redis eviction policy, including LRU versus LFU, based on workload metrics?
Asked once · last asked Sep 21 · Scenario · Senior
Other ways it was asked
- “How do you decide which cache eviction policy to use in Redis for your application?”
- “What metrics would you use to decide between an LRU and LFU cache eviction policy?”
Do you know the difference between LRU and LFU when it comes to Redis?
Asked once · last asked Sep 29 · Concept · Mid-level
HTTP caching and CDN interview questions
HTTP and CDN questions cover browser caches, headers, DNS caching, asset updates, deployment rollbacks, and stale-content debugging. 14 questions.
A DNS record has been updated to point to a new server, but the browser still shows the old content. What could cause this, and how would you resolve it?
Asked once · last asked Apr 24 · Scenario · Mid-level
How would you make browsers load updated CSS or images instead of cached versions?
Asked once · last asked Jun 5 · Scenario · Senior
Other ways it was asked
- “After a deployment, browsers keep loading an old CSS file with the same filename. How can you make users receive the updated styles without manually clearing their cache?”
- “How would you make browsers load an updated image after it has been replaced?”
What is caching, and how is it used in a CDN?
Asked once · last asked Jul 16 · Concept · Junior
If a web app intermittently serves stale data due to caching, what step-by-step approach would you use to isolate whether the cause is the client cache, service worker, CDN, or back end?
Asked once · last asked Aug 29 · Scenario · Senior
How would you handle rolling back a release when static assets are already cached by the browser or CDN?
Asked once · last asked Oct 7 · Scenario · Senior
How would you handle cached content after deploying a fresh version of an application served through CloudFront and Amazon S3?
Asked once · last asked Oct 8 · Tooling · Mid-level
What would you do if users still saw cached content after updated HTML was deployed?
Asked once · last asked Oct 9 · Scenario · Mid-level
If a user repeatedly encounters a caching issue in the app, would you roll back the app version or release a patch immediately?
Asked once · last asked Oct 19 · Scenario · Senior
How can a CDN help an ecommerce platform handle high traffic, and how does it work?
Asked once · last asked Oct 23 · Concept · Mid-level
How is caching related to Akamai?
Asked once · last asked Jul 16 · Concept · Mid-level
Other ways it was asked
- “How is caching related to Akamai, particularly its CDN?”
Can you explain Varnish?
Asked once · last asked Jul 16 · Concept · Junior
How can built-in browser features be used to reduce the number of requests sent to a server?
Asked once · last asked Oct 6 · Tooling · Mid-level
Show 1 more
How can browser caching be controlled, including clearing the cache or setting cache parameters?
Asked once · last asked Oct 12 · Tooling · Junior
Frontend and mobile caching interview questions
Client caching questions cover server state, request deduplication, GraphQL normalization, framework revalidation, offline data, and mobile images. 25 questions.
How would you make ten songs from streaming URLs available offline without storing each song as a complete file in the phone's memory?
Asked once · last asked Feb 27 · Scenario · Senior
How would you design an Android banking app whose main screen shows a list of transactions, fetches data from a REST API, displays cached data offline, refreshes automatically when connectivity returns, supports multiple requests, is testable, handles errors, and keeps the UI responsive?
Asked once · last asked Mar 20 · Design · Senior
An e-commerce catalog uses Redis for backend caching. What frontend strategy would you use to optimize requests between the frontend and backend?
Asked once · last asked Mar 21 · Scenario · Mid-level
Can GraphQL responses be cached, and under what conditions?
Asked once · last asked Apr 27 · Concept · Senior
Other ways it was asked
- “How would you cache a GraphQL request to improve its performance?”
- “What would you consider when analyzing a GraphQL request that needs to be cached?”
How would you design a data-fetching approach in a SPA to avoid request waterfalls, handle caching, and prevent stale responses from overwriting newer ones?
Asked once · last asked Jun 7 · Design · Senior
Is useEffect appropriate for caching data in React, and why?
Asked once · last asked Jun 24 · Concept · Mid-level
When you fetch data in the Next.js App Router, how do you choose between fetching in a Server Component, a Route Handler, or a Client Component, and how does that choice affect caching and revalidation?
Asked once · last asked Jun 29 · Scenario · Senior
Specifically, what would you do about decode/downsampling, memory and caching, and canceling requests on view recycling in Android RecyclerView?
Asked once · last asked Jul 20 · Tooling · Senior
In a fetch wrapper using async/await, how would you implement request deduplication so concurrent calls to the same URL share one in-flight promise, and the cache is cleared after it settles?
Asked once · last asked Jul 26 · Write code · Senior
Would you choose React Query or SWR over a hand-rolled useEffect plus refs approach? And what cache invalidation scenario pushes you to that choice?
Asked once · last asked Jul 26 · Concept · Senior
What is the difference between an Apollo reactive variable and the Apollo cache, and when would you use one over the other?
Asked once · last asked Jul 28 · Concept · Mid-level
How would you fetch and synchronize server data in Angular, including caching, request deduplication, and cancellation with switchMap?
Asked once · last asked Sep 22 · Scenario · Mid-level
Show 12 more
What is cache normalization in GraphQL clients, and how does normalized caching work on the frontend?
Asked once · last asked Sep 29 · Concept · Mid-level
How do you model derived server state such as loading, error, data, pagination, and cache invalidation versus UI state, and where do you draw the boundary?
Asked once · last asked Oct 3 · Design · Senior
How would you prevent repeated API calls in a frontend application?
Asked once · last asked Oct 8 · Scenario · Mid-level
How can I use the user details from the login response on later pages without another database call or API request?
Asked once · last asked Oct 10 · Scenario · Mid-level
In a React and TypeScript app consuming a payments API, how would you structure data fetching and cache invalidation for the payments list and create-payment flow so the UI stays consistent after mutations?
Asked once · last asked Oct 22 · Design · Mid-level
How do you handle image loading and caching in a heavy Android app on low-end devices and poor networks?
Asked once · last asked Oct 23 · Tooling · Senior
What limitations does the Fetch API have, and what problems does React Query help solve?
Asked once · last asked Dec 29 · Concept · Mid-level
In React, how do you manage server state fetching, caching, and invalidation for a large app, and why would you choose React Query over Redux for that?
Asked once · last asked Oct 24 · Tooling · Mid-level
Would you use TanStack Query for frontend data fetching and caching in an e-commerce catalog whose backend uses Redis?
Asked once · last asked Mar 21 · Scenario · Mid-level
Other ways it was asked
- “Why would you use TanStack Query for frontend data fetching and caching in an e-commerce catalog whose backend uses Redis?”
What does local caching mean in a React application?
Asked once · last asked Feb 23 · Concept · Mid-level
Can decomposing a GraphQL request into smaller requests be a caching strategy?
Asked once · last asked Apr 27 · Concept · Senior
How do references work in the Apollo Client cache?
Asked once · last asked Sep 29 · Concept · Mid-level
Caching interview questions for frameworks, data platforms, and LLMs
Compare caching in frameworks, Spark, Snowflake, CI dependencies, build toolchains, and LLM contexts and responses. 17 questions.
How can you implement caching in Spring, and what libraries can you use?
Asked once · last asked Mar 6 · Tooling · Mid-level
How would you configure Hibernate caching and tune Hibernate performance?
Asked once · last asked May 25 · Tooling · Senior
How would you incorporate sophisticated dependency tracking, smarter caching, and validation rules into a large-scale build toolchain?
Asked once · last asked Jun 1 · Design · Senior
What is Redis and how do you use Redis in Laravel?
Asked once · last asked Jul 16 · Tooling · Mid-level
What is the purpose of Hibernate caching?
Asked once · last asked Aug 7 · Concept · Mid-level
When should you unpersist cached data in Spark after a job completes?
Asked once · last asked Aug 19 · Concept · Mid-level
What context caching techniques are available, and when would you use them?
Asked once · last asked Aug 20 · Concept · Mid-level
How does a virtual warehouse utilize its local SSD cache, and what happens to that cache when a warehouse suspends?
Asked once · last asked Aug 26 · Concept · Senior
How can resolved LLM query data be used to reduce future LLM costs and handle recurring questions internally?
Asked once · last asked Sep 8 · Design · Senior
How do you normalize user queries to a common cache key when the wording is different but the meaning is the same?
Asked once · last asked Sep 22 · Design · Senior
How do you implement caching in Bitrix?
Asked once · last asked Oct 12 · Tooling · Mid-level
If a workflow is slow because it reinstalls dependencies every run, how would you design a caching key strategy and restore keys for NPM?
Asked once · last asked Oct 13 · Scenario · Mid-level
Show 2 more
In a GitHub Actions workflow, how would you choose between caching package manager downloads for pip or npm and caching environments or installed dependencies such as venv or node_modules?
Asked once · last asked Oct 13 · Scenario · Mid-level
Other ways it was asked
- “In a GitHub Actions workflow, how would you choose what to cache? The package manager download cache, pip or npm, versus built artifacts like venv or node_modules?”
What does cache mean in the LLM context?
Asked once · last asked Oct 6 · Concept · Junior
Redis performance, monitoring, and recovery interview questions
Focus on measuring cache effectiveness, sizing resources, diagnosing memory pressure and failures, preventing stampedes, and recovering Redis. 21 questions.
How do you monitor and check cache performance metrics in Redis?
Asked once · last asked Sep 21 · Tooling · Mid-level
How do you prevent Redis cache penetration and cache breakdown?
Asked once · last asked Apr 18 · Concept · Mid-level
What problems can arise when storing large values, such as 1 MB, 10 MB, or 100 MB, in Redis?
Asked once · last asked Apr 18 · Scenario · Mid-level
What determines how much data Redis can store?
Asked once · last asked May 25 · Concept · Mid-level
How would you size the memory and CPU for a Redis server?
Asked once · last asked May 25 · Design · Senior
How would you monitor and alert on data consistency issues between Redis and PostgreSQL?
Asked once · last asked Jun 29 · Scenario · Mid-level
After Redis recovers, how would you determine how much data to use to repopulate the cache?
Asked once · last asked Jul 20 · Scenario · Senior
When you have a heap snapshot, how do you decide whether the top retained-size objects represent a real leak versus expected caching?
Asked once · last asked Aug 14 · Scenario · Senior
What happens to the system and the data if Redis crashes while using Sidekiq?
Asked once · last asked Aug 26 · Scenario · Senior
How do we mitigate or prevent data loss and orphaned records if Redis crashes and Sidekiq loses the job queue?
Asked once · last asked Aug 26 · Scenario · Senior
If Redis fails or becomes unavailable, how would you restore it?
Asked once · last asked Sep 8 · Scenario · Mid-level
How would you track cache evictions and memory pressure if Redis is handling high-volume data?
Asked once · last asked Sep 21 · Tooling · Senior
Show 7 more
If Redis were failing, how would you identify that from your monitoring or logs?
Asked once · last asked Sep 21 · Scenario · Senior
What metrics should you track to know if the routing and caching optimizations are working?
Asked once · last asked Sep 22 · Scenario · Senior
How would you explain cache stampede to a mixed audience of PMs and junior engineers and recommend two mitigations in writing?
Asked once · last asked Oct 14 · Concept · Mid-level
Other ways it was asked
- “How would you explain cache stampede to a mixed audience of PMs and junior engineers? And what two mitigations would you recommend in writing?”
If an app repeatedly crashes in production because of excessive memory usage or cached data, what steps would you take to reduce its crash rate?
Asked once · last asked Oct 19 · Scenario · Senior
What happens when an application's cache runs out of memory?
Asked once · last asked Apr 15 · Scenario · Mid-level
What infrastructure do you need for Redis?
Asked once · last asked May 25 · Design · Mid-level
When debugging an issue between a service and Redis, what role should a DevOps engineer play?
Asked once · last asked Sep 29 · Scenario · Mid-level
Redis distributed system design interview questions
Apply Redis to scalable apps, sessions, rate limiting, idempotency, likes, chat, messaging, and reliable updates across services. 22 questions.
How do delivery guarantees differ between Kafka, RabbitMQ, and Redis?
Asked once · last asked Jan 28 · Concept · Senior
How would you choose a cache and database for a payment-card ordering system?
Asked once · last asked Mar 16 · Design · Senior
How would you prevent duplicate records if a request with the same ID arrives after the database write but before the cache update?
Asked once · last asked Mar 16 · Scenario · Senior
Why would you choose RabbitMQ over Redis or Redis Pub/Sub for a messaging system?
Asked once · last asked Mar 19 · Concept · Mid-level
How would you choose retention periods and clean up Redis hashes used for deduplication?
Asked once · last asked Mar 19 · Scenario · Mid-level
Other ways it was asked
- “When using a Redis hash to detect duplicates, how long should you retain it, and when should it expire?”
- “How would you remove old Redis hashes used for deduplication: set a TTL or use another cleanup method?”
How would you handle potential data consistency issues between Redis and PostgreSQL in a real-time bidding system?
Asked once · last asked Jun 29 · Scenario · Senior
How would you preserve the order of updates to Redis and PostgreSQL when using an asynchronous message queue?
Asked once · last asked Jun 29 · Scenario · Senior
What caching mechanisms would you use to support an application scaling to 100,000 users?
Asked once · last asked Jul 16 · Scenario · Mid-level
What role can Redis play in a chat system design?
Asked once · last asked Jul 28 · Concept · Mid-level
Other ways it was asked
- “What role does Redis play in this chat system design?”
Would Kafka replace Redis in a chat system design?
Asked once · last asked Jul 28 · Design · Senior
How would you ensure the permission-change event is reliably delivered and processed exactly once or effectively once across services so caches don't miss invalidations?
Asked once · last asked Sep 16 · Design · Senior
How would you design a scalable full-stack application using Next.js or React, Node.js, GraphQL, and PostgreSQL, including caching and database optimization?
Asked once · last asked Sep 17 · Design · Senior
Other ways it was asked
- “Can you design a scalable full-stack application using Next.js or React, Node.js, GraphQL, and PostgreSQL? What would your approach be for caching and database optimization?”
Show 9 more
How would you design the complete flow for a like, including the controller, Redis, and database, and how would those components interact?
Asked once · last asked Sep 18 · Design · Senior
What are the risks of writing likes from a controller directly to Redis using a post key?
Asked once · last asked Sep 18 · Scenario · Senior
What would you store in Redis to make like counts and user-like lookups both fast and accurate?
Asked once · last asked Sep 18 · Design · Senior
How would you quickly show a user that they have already liked a post, including when they sign in from another device?
Asked once · last asked Sep 18 · Design · Senior
How should you choose a TTL for an idempotency key stored in Redis?
Asked once · last asked Sep 22 · Scenario · Senior
In a high-load Node.js service using PostgreSQL and Redis, how would you prevent race conditions, lost updates, cache inconsistencies, and deadlocks while ensuring correct results?
Asked once · last asked Oct 7 · Scenario · Senior
How would you scale a web application to approximately one million users using access tokens, refresh tokens, Redis, local storage, and horizontal scaling?
Asked once · last asked Oct 7 · Design · Mid-level
How do message queues, Redis, and dead-letter queues (DLQs) support distributed systems?
Asked once · last asked Oct 15 · Concept · Senior
How would you redesign session management when sessions are stored in memory and servers are restarted during updates?
Asked once · last asked Oct 19 · Design · Senior
Related interview questions
- Software Engineer interview questions
- Data Engineer interview questions
- AI Engineer interview questions
- DevOps Engineer interview questions
- Machine Learning Engineer interview questions
- Data Structures and Algorithms interview questions
- OOP and Design Patterns interview questions
- System Design interview questions
- Microservices interview questions
- REST API interview questions
- Kafka and Message Queues interview questions
- Operating Systems interview questions
- Computer Networks interview questions
- Git interview questions
How this list is made
Every question here was asked by a real interviewer in a real job interview that a candidate ran MeetAssist in. After the call, the interviewer's questions are pulled from the transcript. Practice sessions, tests, exams and anything that was not a job interview are dropped.
Questions are rewritten so they make sense on their own: names of people, employers and clients are removed, and speech-to-text mistakes are fixed. Small talk, logistics and questions about one candidate's own résumé are left out. Rephrasings of the same question are merged, and the count is the number of different interviews it came up in.
The interviews come from candidates who use MeetAssist, so they lean towards software, data and AI roles: the shares describe these interviews, not every Caching and Redis interview. Answers to the most asked questions are written and checked by an editor; a "common mistake" is shown only when reviews of real answers in these interviews show it, with the count.
114 interviews, 89 candidates, Dec 2025 to Oct 2026. Updated every month with new interviews.
Or add the Chrome extension