You are using Cloud Memorystore for Redis as a caching layer. You notice that cache hit ratio is below 50%. What is the best action to improve it?
Longer TTL keeps data in cache for more reads.
Why this answer
A low cache hit ratio indicates that a large proportion of requests are not finding their data in the cache, forcing the application to fetch from the primary database. Increasing the TTL (time-to-live) for cached data keeps valid entries in Redis longer, reducing the frequency of evictions and cache misses. This directly improves the hit ratio by ensuring that more requests can be served from the cache before the data expires.
Exam trap
Google Cloud often tests the misconception that a low cache hit ratio is always a memory capacity problem, leading candidates to choose 'increase memory size' when the real issue is data expiring too quickly due to short TTLs.
How to eliminate wrong answers
Option A is wrong because flushing the cache periodically removes all data, which would drastically reduce the hit ratio and increase load on the database, the opposite of the desired effect. Option C is wrong because enabling persistence (e.g., RDB snapshots or AOF logs) protects against data loss on restart but does not influence how long data remains in the cache or the hit ratio. Option D is wrong because increasing instance memory size only delays evictions under the maxmemory-policy; if the TTL is too short, data still expires quickly and the hit ratio remains low regardless of memory size.