你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Overview
Azure Redis Cache is based on the popular open source Redis project. It gives you access to a secure, dedicated Redis instance, managed by Microsoft and accessible from your Azure apps.
Redis is an advanced key-value store, where keys can contain data structures such as strings, hashes, lists, sets, and sorted sets. Redis supports a set of atomic operations on these data types.
Learn more about Azure Redis Cache.
Management API
Create and manage your Redis resources in your subscription with the Redis management API.
pip install redis
pip install azure-mgmt-redis
Example
The following example creates a new Redis cache:
from azure.mgmt.redis import RedisManagementClient
from azure.mgmt.redis.models import Sku, RedisCreateOrUpdateParameters
redis_client = RedisManagementClient(
credentials,
subscription_id
)
group_name = 'myresourcegroup'
cache_name = 'mycachename'
redis_cache = redis_client.redis.create_or_update(
group_name,
cache_name,
RedisCreateOrUpdateParameters(
sku = Sku(name = 'Basic', family = 'C', capacity = '1'),
location = "East US"
)
)
# redis_cache is a RedisResourceWithAccessKey instance