Deploy a PHP App Engine Standard service using Cloud SQL and minimize database queries. What should you do?
Choose an answer
Tap an option to check your answer.
Correct answer: Set memcache to dedicated. Use a cache key derived from a hash of the SQL query and return cached results before querying Cloud SQL..
Why this is the answer
To minimize database queries, caching is essential. App Engine's Memcache service is suitable for this. Using a dedicated Memcache instance provides better performance and isolation than shared. Deriving a cache key from a hash of the SQL query ensures that unique queries have unique cache entries. Checking Memcache for this key before executing the SQL query allows you to return cached results directly, significantly reducing database load. The incorrect options propose less efficient or problematic approaches. Populating cache keys with a cron task every minute might lead to stale data or unnecessary cache updates if the data doesn't change frequently. Using a single key for all queries would cause frequent overwrites and cache invalidation issues, making the cache ineffective. Shared Memcache offers less predictable performance compared to dedicated.
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