Python 用 Azure Redis Cache ライブラリAzure Redis Cache libraries for Python

概要Overview

Azure Redis Cache は、広く普及しているオープン ソースの Redis プロジェクトを基盤にしています。Azure Redis Cache is based on the popular open source Redis project. これを使用すると、Microsoft によって管理されている、セキュリティで保護された専用 Redis インスタンスに、ご利用の Azure アプリでアクセスできます。It gives you access to a secure, dedicated Redis instance, managed by Microsoft and accessible from your Azure apps.

Redis は高度なキーと値のストアです。キーには、文字列、ハッシュ、リスト、セット、ソート済みセットなどのデータ構造を格納できます。Redis is an advanced key-value store, where keys can contain data structures such as strings, hashes, lists, sets, and sorted sets. Redis では、このようなデータ型に対する一連のアトミック操作がサポートされています。Redis supports a set of atomic operations on these data types.

Azure Redis Cache の詳細については、こちらを参照してください。Learn more about Azure Redis Cache.

管理 APIManagement API

Redis 管理 API を使用すると、ご利用のサブスクリプションの Redis リソースを作成したり管理したりすることができます。Create and manage your Redis resources in your subscription with the Redis management API.

pip install redis
pip install azure-mgmt-redis

Example

次の例では、新しい Redis キャッシュを作成します。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