How to connect to Redis Memorystore instance from a python Cloud Function

200 views
Skip to first unread message

Darcio Domingues

unread,
May 3, 2022, 1:29:51 PM5/3/22
to Google Cloud Memorystore Discuss
Hi guys.
I already have seen in documentation and pots but I cannot to connect to my Redis Memorystore instance (no AUTH) from my Cloud Function (Python) with basic example like shown in service documentation:

import os
import redis

redis_host = os.environ.get('REDISHOST', 'localhost')
redis_port = int(os.environ.get('REDISPORT', 6379))
redis_client = redis.StrictRedis(host=redis_host, port=redis_port)

def visit_count(request):
    value = redis_client.incr('visits', 1)
    return 'Visit count: {}'.format(value)


do you help me with some idea?
Reply all
Reply to author
Forward
0 new messages