PHP 5 has reached end of support and will be
deprecated
on January 31, 2026. After deprecation, you won't be able to deploy PHP 5
applications, even if your organization previously used an organization policy to
re-enable deployments of legacy runtimes. Your existing PHP
5 applications will continue to run and receive traffic after their
deprecation date. We recommend that
you
migrate to the latest supported version of PHP.
Using Memcache
Stay organized with collections
Save and categorize content based on your preferences.
This page describes how to configure and monitor the memcache service for your
application using the Google Cloud console. It also describes how to use the
App Engine Memcache PHP API to set and retrieve cached values. To learn more about memcache,
read the Memcache Overview.
Configuring memcache
- Go to the Memcache page in the Google Cloud console.
Go to the Memcache page
Select the memcache service level you want to use:
- Shared (default) - free and provides cache capacity on a best-effort
basis.
- Dedicated - billed by the GB-hour of cache size and provides a fixed
cache capacity assigned exclusively to your application.
Learn more about available service classes in Memcache Overview.
Caching and retrieving values
Caching a value
Use Memcache::set
to add a key's
value:
Looking up cached values
Use Memcache::get
to look up the
value of a single key:
Monitoring memcache in the Google Cloud console
- Go to the Memcache page in the Google Cloud console.
Go to the Memcache page
- Look at the following reports:
- Memcache service level: Shows if your application is using the Shared
or Dedicated service level.
If you are an owner of the project, you can switch between the two. Learn
more about the service levels.
- Hit ratio: Shows the percentage of data requests that were served from
the cache, as well as the raw number of data requests that were served
from the cache.
- Items in the cache.
- Oldest item age: The age of the oldest cached item. Note that the age
of an item is reset every time it is used, either read or written.
- Total cache size.
You can take any of the following actions:
- New key: Add a new key to the cache.
- Find a key: Retrieve an existing key.
- Flush cache: Remove all the key-value pairs from the cache.
(Dedicated memcache only) Look through the list of Hot keys.
- "Hot keys" are keys that receive more than 100 queries per second (QPS) in
the memcache.
- This list includes up to 100 hot keys, sorted by highest QPS.
What's next
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-21 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-21 UTC."],[[["\u003cp\u003eThis page guides users on configuring and monitoring the memcache service for applications using the Google Cloud console, as well as utilizing the App Engine Memcache PHP API for caching.\u003c/p\u003e\n"],["\u003cp\u003eMemcache offers two service levels, Shared and Dedicated, with the former being free and the latter providing a fixed, billed cache capacity.\u003c/p\u003e\n"],["\u003cp\u003eUsers can cache values using \u003ccode\u003eMemcache::set\u003c/code\u003e and retrieve cached values using \u003ccode\u003eMemcache::get\u003c/code\u003e via the App Engine Memcache PHP API.\u003c/p\u003e\n"],["\u003cp\u003eThe Google Cloud console allows for monitoring of the memcache service level, hit ratio, cache items, oldest item age, and total cache size, and offers actions like adding, finding, or flushing keys.\u003c/p\u003e\n"],["\u003cp\u003eDedicated memcache provides a hot key list for keys that receives more than 100 queries per second.\u003c/p\u003e\n"]]],[],null,[]]