You are deploying a PHP App Engine Standard service with Cloud SQL as the backend. You want to minimize the number of queries to the database. What should you do?
Choose an answer
Tap an option to check your answer.
Correct answer: Set the memcache service level to dedicated. Create a key from the hash of the query, and return database values from memcache before issuing a query to Cloud SQL..
Why this is the answer
The correct option leverages Memcache effectively for query caching. By setting the service level to dedicated, you ensure consistent performance and capacity for your caching needs. Hashing the query to create a unique key allows you to store and retrieve specific query results. Checking Memcache before querying Cloud SQL significantly reduces database load by serving frequently requested data directly from the cache. The other options are less effective: Populating cache with a cron task every minute (option 2) is inefficient and can lead to stale data if the underlying database changes frequently. It also doesn't address on-demand caching for specific queries. Using a shared Memcache service (options 3 and 4) offers less predictable performance and is not ideal for critical caching needs. Saving all expected queries to a single key (options 3 and 4) is impractical and inefficient. Memcache is designed for key-value pairs, where each key represents a specific piece of data, not a collection of all possible queries.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed