title | description | services | documentationcenter | author | manager | editor | ms.assetid | ms.service | ms.devlang | ms.topic | ms.tgt_pltfrm | ms.workload | ms.date | ms.author |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
How to use Azure Redis Cache with Python | Microsoft Docs |
Get started with Azure Redis Cache using Python |
redis-cache |
steved0x |
douge |
v-lincan |
f186202c-fdad-4398-af8c-aee91ec96ba3 |
cache |
python |
hero-article |
cache-redis |
tbd |
01/06/2017 |
sdanie |
[!div class="op_single_selector"]
This topic shows you how to get started with Azure Redis Cache using Python.
Install redis-py.
[!INCLUDE redis-cache-create]
[!INCLUDE redis-cache-create]
Some Redis clients don't support SSL, and by default the non-SSL port is disabled for new Azure Redis Cache instances. At the time of this writing, the redis-py client doesn't support SSL.
[!INCLUDE redis-cache-create]
>>> import redis
>>> r = redis.StrictRedis(host='<name>.redis.cache.windows.net',
port=6380, db=0, password='<key>', ssl=True)
>>> r.set('foo', 'bar')
True
>>> r.get('foo')
b'bar'
Replace <name>
with your cache name and key
with your access key.