Caching Interview Questions for 5 Years Experience
Caching Interview Questions for 5 Years Experience Work through these 12 questions out loud. Open any question for the full model answer, the trap to avoid, and the follow-up a panel usually asks.
What is an ExecutorService and why use it?
Instead of new Thread per task, submit Runnable to fixed pool sized to CPU/IO profile. Handle Future results and exceptions. On shutdown hook call shutdown() and...
What are weak references and WeakHashMap use cases?
Attach metadata to objects without extending their lifetime — canonical mapping while object lives. When key GCs, entry drops. Do not rely on timing. For API response caching...
Redis caching patterns: cache-aside vs write-through?
@Cacheable("users") on findById — Redis cache-aside via Spring Data Redis. Update user: @CacheEvict. TTL 15m + jitter. Hot product page: lock on miss with Redisson. Do not...
Your Spring Boot app works locally but fails after deployment. What are the first 3 things you check?
First: confirm `spring.profiles.active` and required env vars exist in prod (`kubectl describe pod`, deployment manifest). Second: read startup logs and `/actuator/health` —...
You deployed a new version but users still hit the old behavior. Why?
Check K8s rollout status — old ReplicaSet still receiving traffic. Bust cache on static assets; API GET with `Cache-Control`. Confirm image tag in running pod matches CI build....
How do you implement rate limiting for APIs?
Apply at API Gateway; in-app use Redis-backed limiter for cluster-wide counts. ```java @RateLimiter(name = "apiLimiter") @GetMapping("/users") public List<User> users() {...
What is the difference between ArrayList and LinkedList?
ArrayList: dynamic array, great for get(i) and iteration, amortized append. LinkedList: node chain, costly random access, only wins for frequent insert/remove in middle with...
What is Spring Boot Docker Compose dev services support?
Add compose.yaml with postgres and redis services. Include spring-boot-docker-compose on runtimeOnly. Boot starts Postgres, sets JDBC URL — zero local install. CI uses...
How would you design a rate-limited REST API?
API gateway or filter applies token bucket per API key — Redis stores tokens with TTL. Exceeding limit returns 429 + Retry-After. Different tiers per plan. Log rejections for...
What is Hibernate second-level cache and when enable it?
Enable for ProductCategory, Currency — READ_ONLY, rarely changed. spring.jpa.properties.hibernate.cache.use_second_level_cache=true with Caffeine region factory. Avoid on...
What are idempotency keys and how implement them in REST APIs?
Client sends Idempotency-Key: uuid on POST /payments. Server Redis SETNX key, process, store response JSON. Retry with same key returns 201 + original body without double...
Your application memory usage keeps increasing over time. What do you suspect?
Suspect memory leak if heap used grows after GC without traffic drop. Capture heap dump on OOM (`-XX:+HeapDumpOnOutOfMemoryError`), compare dominator tree. Common in Spring:...
Caching Interview Questions and Answers · Top 50 Caching Interview Questions and Answers (2026 Edition) · Top 40 Caching Interview Questions | Must-Prepare before interview. · Caching Interview Questions Every Fresher Must Know
All interview question lists · Interview guides · Home · Support the platform