The `google-cloud-memcache` client library for Python provides programmatic access to the Google Cloud Memorystore for Memcached API. It allows developers to manage and interact with fully-managed Memcached instances on Google Cloud. The library is currently at version 1.15.0 and is actively maintained as part of the broader `googleapis/google-cloud-python` monorepo, with frequent updates.
pip install google-cloud-memcacheVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to instantiate the `CloudMemcacheClient` and list existing Memcached instances within a specified Google Cloud project and location. Ensure your `GOOGLE_CLOUD_PROJECT` environment variable is set and you've authenticated with `gcloud auth application-default login` or equivalent service account credentials. The Memcache API must also be enabled for your project.
Plan to migrate existing Memcached instances to Memorystore for Valkey. For new projects, avoid creating Memorystore for Memcached instances. Consult the official Google Cloud documentation for migration guides.
For Python 3 App Engine, use the `google-cloud-memcache` library to interact with a Memorystore for Memcached instance, or switch to Memorystore for Valkey. Do not expect `google.appengine.api.memcache` to work in Python 3.
Run `gcloud auth application-default login` in your terminal or provide a service account key JSON file via `os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = '/path/to/key.json'`.
Ensure the library is installed using pip: `pip install google-cloud-memcache`.
Verify the Memcached instance's IP address and port, check VPC network peering and firewall rules to ensure they allow traffic, and confirm the instance is in a 'READY' state and located in the same region and network as the client.
Allocate additional IP addresses to your private services access connection. Refer to Google Cloud documentation on expanding IP address allocation for private services access.
Establish a private services access connection for your project's network by following the setup instructions in the Google Cloud documentation.
Grant the required IAM roles to the principal for the Memcached instance or project. Common roles include 'Cloud Memorystore Memcached Editor' or more granular permissions like `memcache.instances.get` for read access.
No dependency data recorded yet.