適用于 Python 的 Azure Cache for Redis 程式庫
概觀
Azure Cache for Redis是以熱門的開放原始碼 Redis 專案為基礎。 它可讓您存取由 Microsoft 管理的安全專用 Redis 伺服器,並可從您的 Azure 應用程式存取。
Redis 伺服器是進階索引鍵/值存放區,其中索引鍵可以包含資料結構,例如字串、雜湊、清單、集合和已排序的集合。 Redis 伺服器支援這些資料類型的一組不可部分完成作業。
若要深入瞭解,請參閱Azure Cache for Redis。
管理 API
使用 Redis 管理 API,在訂用帳戶中建立和管理您的Azure Cache for Redis資源。
pip install redis
pip install azure-mgmt-redis
範例
下列範例會建立新的快取:
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
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應