Skip to content

Latest commit

 

History

History
 
 

App Engine Memorystore for Redis Sample

Open in Cloud Shell

This is a sample app for Google App Engine that demonstrates how to replace use of the Memcache API with the Memorystore for Redis offering. This newer library can be used on App Engine with either Python 2.7 or Python 3.

Code taken from the Memcache sample is included in this new sample, with each line commented out with two # marks. This allows the older solution's approach to be contrasted with the Memorystore for Redis approach.

Prior to deploying this sample, a serverless VPC connector must be created and then a Memorystore for Redis instance on the same VPC. The IP address and port number of the Redis instance, and the name of the VPC connector should be entered in either app.yaml (for Python 2.7) or app3.yaml (for Python 3).

To deploy and run this sample in App Engine standard for Python 2.7:

pip install -t lib -r requirements.txt
gcloud app deploy

To deploy and run this sample in App Engine standard for Python 3.7:

gcloud app deploy app3.yaml