1. Packages
  2. Azure Classic
  3. API Docs
  4. redis
  5. getCache

We recommend using Azure Native.

Azure Classic v5.49.0 published on Tuesday, Aug 29, 2023 by Pulumi

azure.redis.getCache

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.49.0 published on Tuesday, Aug 29, 2023 by Pulumi

    Use this data source to access information about an existing Redis Cache

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Azure.Redis.GetCache.Invoke(new()
        {
            Name = "myrediscache",
            ResourceGroupName = "redis-cache",
        });
    
        return new Dictionary<string, object?>
        {
            ["primaryAccessKey"] = example.Apply(getCacheResult => getCacheResult.PrimaryAccessKey),
            ["hostname"] = example.Apply(getCacheResult => getCacheResult.Hostname),
        };
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/redis"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := redis.LookupCache(ctx, &redis.LookupCacheArgs{
    			Name:              "myrediscache",
    			ResourceGroupName: "redis-cache",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("primaryAccessKey", example.PrimaryAccessKey)
    		ctx.Export("hostname", example.Hostname)
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azure.redis.RedisFunctions;
    import com.pulumi.azure.redis.inputs.GetCacheArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var example = RedisFunctions.getCache(GetCacheArgs.builder()
                .name("myrediscache")
                .resourceGroupName("redis-cache")
                .build());
    
            ctx.export("primaryAccessKey", example.applyValue(getCacheResult -> getCacheResult.primaryAccessKey()));
            ctx.export("hostname", example.applyValue(getCacheResult -> getCacheResult.hostname()));
        }
    }
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.redis.get_cache(name="myrediscache",
        resource_group_name="redis-cache")
    pulumi.export("primaryAccessKey", example.primary_access_key)
    pulumi.export("hostname", example.hostname)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = azure.redis.getCache({
        name: "myrediscache",
        resourceGroupName: "redis-cache",
    });
    export const primaryAccessKey = example.then(example => example.primaryAccessKey);
    export const hostname = example.then(example => example.hostname);
    
    variables:
      example:
        fn::invoke:
          Function: azure:redis:getCache
          Arguments:
            name: myrediscache
            resourceGroupName: redis-cache
    outputs:
      primaryAccessKey: ${example.primaryAccessKey}
      hostname: ${example.hostname}
    

    Using getCache

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getCache(args: GetCacheArgs, opts?: InvokeOptions): Promise<GetCacheResult>
    function getCacheOutput(args: GetCacheOutputArgs, opts?: InvokeOptions): Output<GetCacheResult>
    def get_cache(name: Optional[str] = None,
                  resource_group_name: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetCacheResult
    def get_cache_output(name: Optional[pulumi.Input[str]] = None,
                  resource_group_name: Optional[pulumi.Input[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetCacheResult]
    func LookupCache(ctx *Context, args *LookupCacheArgs, opts ...InvokeOption) (*LookupCacheResult, error)
    func LookupCacheOutput(ctx *Context, args *LookupCacheOutputArgs, opts ...InvokeOption) LookupCacheResultOutput

    > Note: This function is named LookupCache in the Go SDK.

    public static class GetCache 
    {
        public static Task<GetCacheResult> InvokeAsync(GetCacheArgs args, InvokeOptions? opts = null)
        public static Output<GetCacheResult> Invoke(GetCacheInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetCacheResult> getCache(GetCacheArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: azure:redis/getCache:getCache
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string

    The name of the Redis cache

    ResourceGroupName string

    The name of the resource group the Redis cache instance is located in.

    Name string

    The name of the Redis cache

    ResourceGroupName string

    The name of the resource group the Redis cache instance is located in.

    name String

    The name of the Redis cache

    resourceGroupName String

    The name of the resource group the Redis cache instance is located in.

    name string

    The name of the Redis cache

    resourceGroupName string

    The name of the resource group the Redis cache instance is located in.

    name str

    The name of the Redis cache

    resource_group_name str

    The name of the resource group the Redis cache instance is located in.

    name String

    The name of the Redis cache

    resourceGroupName String

    The name of the resource group the Redis cache instance is located in.

    getCache Result

    The following output properties are available:

    Capacity int

    The size of the Redis Cache deployed.

    EnableNonSslPort bool

    Whether the SSL port is enabled.

    Family string

    The SKU family/pricing group used. Possible values are C (for Basic/Standard SKU family) and P (for Premium)

    Hostname string

    The Hostname of the Redis Instance

    Id string

    The provider-assigned unique ID for this managed resource.

    Location string

    The location of the Redis Cache.

    MinimumTlsVersion string

    The minimum TLS version.

    Name string
    PatchSchedules List<GetCachePatchSchedule>

    A list of patch_schedule blocks as defined below.

    Port int

    The non-SSL Port of the Redis Instance

    PrimaryAccessKey string

    The Primary Access Key for the Redis Instance

    PrimaryConnectionString string

    The primary connection string of the Redis Instance.

    PrivateStaticIpAddress string

    The Static IP Address assigned to the Redis Cache when hosted inside the Virtual Network.

    RedisConfigurations List<GetCacheRedisConfiguration>

    A redis_configuration block as defined below.

    ResourceGroupName string
    SecondaryAccessKey string

    The Secondary Access Key for the Redis Instance

    SecondaryConnectionString string

    The secondary connection string of the Redis Instance.

    ShardCount int
    SkuName string

    The SKU of Redis used. Possible values are Basic, Standard and Premium.

    SslPort int

    The SSL Port of the Redis Instance

    SubnetId string
    Tags Dictionary<string, string>
    Zones List<string>

    A list of Availability Zones in which this Redis Cache is located.

    Capacity int

    The size of the Redis Cache deployed.

    EnableNonSslPort bool

    Whether the SSL port is enabled.

    Family string

    The SKU family/pricing group used. Possible values are C (for Basic/Standard SKU family) and P (for Premium)

    Hostname string

    The Hostname of the Redis Instance

    Id string

    The provider-assigned unique ID for this managed resource.

    Location string

    The location of the Redis Cache.

    MinimumTlsVersion string

    The minimum TLS version.

    Name string
    PatchSchedules []GetCachePatchSchedule

    A list of patch_schedule blocks as defined below.

    Port int

    The non-SSL Port of the Redis Instance

    PrimaryAccessKey string

    The Primary Access Key for the Redis Instance

    PrimaryConnectionString string

    The primary connection string of the Redis Instance.

    PrivateStaticIpAddress string

    The Static IP Address assigned to the Redis Cache when hosted inside the Virtual Network.

    RedisConfigurations []GetCacheRedisConfiguration

    A redis_configuration block as defined below.

    ResourceGroupName string
    SecondaryAccessKey string

    The Secondary Access Key for the Redis Instance

    SecondaryConnectionString string

    The secondary connection string of the Redis Instance.

    ShardCount int
    SkuName string

    The SKU of Redis used. Possible values are Basic, Standard and Premium.

    SslPort int

    The SSL Port of the Redis Instance

    SubnetId string
    Tags map[string]string
    Zones []string

    A list of Availability Zones in which this Redis Cache is located.

    capacity Integer

    The size of the Redis Cache deployed.

    enableNonSslPort Boolean

    Whether the SSL port is enabled.

    family String

    The SKU family/pricing group used. Possible values are C (for Basic/Standard SKU family) and P (for Premium)

    hostname String

    The Hostname of the Redis Instance

    id String

    The provider-assigned unique ID for this managed resource.

    location String

    The location of the Redis Cache.

    minimumTlsVersion String

    The minimum TLS version.

    name String
    patchSchedules List<GetCachePatchSchedule>

    A list of patch_schedule blocks as defined below.

    port Integer

    The non-SSL Port of the Redis Instance

    primaryAccessKey String

    The Primary Access Key for the Redis Instance

    primaryConnectionString String

    The primary connection string of the Redis Instance.

    privateStaticIpAddress String

    The Static IP Address assigned to the Redis Cache when hosted inside the Virtual Network.

    redisConfigurations List<GetCacheRedisConfiguration>

    A redis_configuration block as defined below.

    resourceGroupName String
    secondaryAccessKey String

    The Secondary Access Key for the Redis Instance

    secondaryConnectionString String

    The secondary connection string of the Redis Instance.

    shardCount Integer
    skuName String

    The SKU of Redis used. Possible values are Basic, Standard and Premium.

    sslPort Integer

    The SSL Port of the Redis Instance

    subnetId String
    tags Map<String,String>
    zones List<String>

    A list of Availability Zones in which this Redis Cache is located.

    capacity number

    The size of the Redis Cache deployed.

    enableNonSslPort boolean

    Whether the SSL port is enabled.

    family string

    The SKU family/pricing group used. Possible values are C (for Basic/Standard SKU family) and P (for Premium)

    hostname string

    The Hostname of the Redis Instance

    id string

    The provider-assigned unique ID for this managed resource.

    location string

    The location of the Redis Cache.

    minimumTlsVersion string

    The minimum TLS version.

    name string
    patchSchedules GetCachePatchSchedule[]

    A list of patch_schedule blocks as defined below.

    port number

    The non-SSL Port of the Redis Instance

    primaryAccessKey string

    The Primary Access Key for the Redis Instance

    primaryConnectionString string

    The primary connection string of the Redis Instance.

    privateStaticIpAddress string

    The Static IP Address assigned to the Redis Cache when hosted inside the Virtual Network.

    redisConfigurations GetCacheRedisConfiguration[]

    A redis_configuration block as defined below.

    resourceGroupName string
    secondaryAccessKey string

    The Secondary Access Key for the Redis Instance

    secondaryConnectionString string

    The secondary connection string of the Redis Instance.

    shardCount number
    skuName string

    The SKU of Redis used. Possible values are Basic, Standard and Premium.

    sslPort number

    The SSL Port of the Redis Instance

    subnetId string
    tags {[key: string]: string}
    zones string[]

    A list of Availability Zones in which this Redis Cache is located.

    capacity int

    The size of the Redis Cache deployed.

    enable_non_ssl_port bool

    Whether the SSL port is enabled.

    family str

    The SKU family/pricing group used. Possible values are C (for Basic/Standard SKU family) and P (for Premium)

    hostname str

    The Hostname of the Redis Instance

    id str

    The provider-assigned unique ID for this managed resource.

    location str

    The location of the Redis Cache.

    minimum_tls_version str

    The minimum TLS version.

    name str
    patch_schedules Sequence[GetCachePatchSchedule]

    A list of patch_schedule blocks as defined below.

    port int

    The non-SSL Port of the Redis Instance

    primary_access_key str

    The Primary Access Key for the Redis Instance

    primary_connection_string str

    The primary connection string of the Redis Instance.

    private_static_ip_address str

    The Static IP Address assigned to the Redis Cache when hosted inside the Virtual Network.

    redis_configurations Sequence[GetCacheRedisConfiguration]

    A redis_configuration block as defined below.

    resource_group_name str
    secondary_access_key str

    The Secondary Access Key for the Redis Instance

    secondary_connection_string str

    The secondary connection string of the Redis Instance.

    shard_count int
    sku_name str

    The SKU of Redis used. Possible values are Basic, Standard and Premium.

    ssl_port int

    The SSL Port of the Redis Instance

    subnet_id str
    tags Mapping[str, str]
    zones Sequence[str]

    A list of Availability Zones in which this Redis Cache is located.

    capacity Number

    The size of the Redis Cache deployed.

    enableNonSslPort Boolean

    Whether the SSL port is enabled.

    family String

    The SKU family/pricing group used. Possible values are C (for Basic/Standard SKU family) and P (for Premium)

    hostname String

    The Hostname of the Redis Instance

    id String

    The provider-assigned unique ID for this managed resource.

    location String

    The location of the Redis Cache.

    minimumTlsVersion String

    The minimum TLS version.

    name String
    patchSchedules List<Property Map>

    A list of patch_schedule blocks as defined below.

    port Number

    The non-SSL Port of the Redis Instance

    primaryAccessKey String

    The Primary Access Key for the Redis Instance

    primaryConnectionString String

    The primary connection string of the Redis Instance.

    privateStaticIpAddress String

    The Static IP Address assigned to the Redis Cache when hosted inside the Virtual Network.

    redisConfigurations List<Property Map>

    A redis_configuration block as defined below.

    resourceGroupName String
    secondaryAccessKey String

    The Secondary Access Key for the Redis Instance

    secondaryConnectionString String

    The secondary connection string of the Redis Instance.

    shardCount Number
    skuName String

    The SKU of Redis used. Possible values are Basic, Standard and Premium.

    sslPort Number

    The SSL Port of the Redis Instance

    subnetId String
    tags Map<String>
    zones List<String>

    A list of Availability Zones in which this Redis Cache is located.

    Supporting Types

    GetCachePatchSchedule

    DayOfWeek string

    the Weekday name for the patch item

    MaintenanceWindow string

    The ISO 8601 timespan which specifies the amount of time the Redis Cache can be updated.

    StartHourUtc int

    The Start Hour for maintenance in UTC

    DayOfWeek string

    the Weekday name for the patch item

    MaintenanceWindow string

    The ISO 8601 timespan which specifies the amount of time the Redis Cache can be updated.

    StartHourUtc int

    The Start Hour for maintenance in UTC

    dayOfWeek String

    the Weekday name for the patch item

    maintenanceWindow String

    The ISO 8601 timespan which specifies the amount of time the Redis Cache can be updated.

    startHourUtc Integer

    The Start Hour for maintenance in UTC

    dayOfWeek string

    the Weekday name for the patch item

    maintenanceWindow string

    The ISO 8601 timespan which specifies the amount of time the Redis Cache can be updated.

    startHourUtc number

    The Start Hour for maintenance in UTC

    day_of_week str

    the Weekday name for the patch item

    maintenance_window str

    The ISO 8601 timespan which specifies the amount of time the Redis Cache can be updated.

    start_hour_utc int

    The Start Hour for maintenance in UTC

    dayOfWeek String

    the Weekday name for the patch item

    maintenanceWindow String

    The ISO 8601 timespan which specifies the amount of time the Redis Cache can be updated.

    startHourUtc Number

    The Start Hour for maintenance in UTC

    GetCacheRedisConfiguration

    AofBackupEnabled bool
    AofStorageConnectionString0 string
    AofStorageConnectionString1 string
    EnableAuthentication bool

    Specifies if authentication is enabled

    Maxclients int
    MaxfragmentationmemoryReserved int

    Value in megabytes reserved to accommodate for memory fragmentation.

    MaxmemoryDelta int

    The max-memory delta for this Redis instance.

    MaxmemoryPolicy string

    How Redis will select what to remove when maxmemory is reached.

    MaxmemoryReserved int

    The value in megabytes reserved for non-cache usage e.g. failover

    NotifyKeyspaceEvents string
    RdbBackupEnabled bool

    Is Backup Enabled? Only supported on Premium SKUs.

    RdbBackupFrequency int

    The Backup Frequency in Minutes. Only supported on Premium SKUs.

    RdbBackupMaxSnapshotCount int

    The maximum number of snapshots that can be created as a backup.

    RdbStorageConnectionString string

    The Connection String to the Storage Account. Only supported for Premium SKUs.

    AofBackupEnabled bool
    AofStorageConnectionString0 string
    AofStorageConnectionString1 string
    EnableAuthentication bool

    Specifies if authentication is enabled

    Maxclients int
    MaxfragmentationmemoryReserved int

    Value in megabytes reserved to accommodate for memory fragmentation.

    MaxmemoryDelta int

    The max-memory delta for this Redis instance.

    MaxmemoryPolicy string

    How Redis will select what to remove when maxmemory is reached.

    MaxmemoryReserved int

    The value in megabytes reserved for non-cache usage e.g. failover

    NotifyKeyspaceEvents string
    RdbBackupEnabled bool

    Is Backup Enabled? Only supported on Premium SKUs.

    RdbBackupFrequency int

    The Backup Frequency in Minutes. Only supported on Premium SKUs.

    RdbBackupMaxSnapshotCount int

    The maximum number of snapshots that can be created as a backup.

    RdbStorageConnectionString string

    The Connection String to the Storage Account. Only supported for Premium SKUs.

    aofBackupEnabled Boolean
    aofStorageConnectionString0 String
    aofStorageConnectionString1 String
    enableAuthentication Boolean

    Specifies if authentication is enabled

    maxclients Integer
    maxfragmentationmemoryReserved Integer

    Value in megabytes reserved to accommodate for memory fragmentation.

    maxmemoryDelta Integer

    The max-memory delta for this Redis instance.

    maxmemoryPolicy String

    How Redis will select what to remove when maxmemory is reached.

    maxmemoryReserved Integer

    The value in megabytes reserved for non-cache usage e.g. failover

    notifyKeyspaceEvents String
    rdbBackupEnabled Boolean

    Is Backup Enabled? Only supported on Premium SKUs.

    rdbBackupFrequency Integer

    The Backup Frequency in Minutes. Only supported on Premium SKUs.

    rdbBackupMaxSnapshotCount Integer

    The maximum number of snapshots that can be created as a backup.

    rdbStorageConnectionString String

    The Connection String to the Storage Account. Only supported for Premium SKUs.

    aofBackupEnabled boolean
    aofStorageConnectionString0 string
    aofStorageConnectionString1 string
    enableAuthentication boolean

    Specifies if authentication is enabled

    maxclients number
    maxfragmentationmemoryReserved number

    Value in megabytes reserved to accommodate for memory fragmentation.

    maxmemoryDelta number

    The max-memory delta for this Redis instance.

    maxmemoryPolicy string

    How Redis will select what to remove when maxmemory is reached.

    maxmemoryReserved number

    The value in megabytes reserved for non-cache usage e.g. failover

    notifyKeyspaceEvents string
    rdbBackupEnabled boolean

    Is Backup Enabled? Only supported on Premium SKUs.

    rdbBackupFrequency number

    The Backup Frequency in Minutes. Only supported on Premium SKUs.

    rdbBackupMaxSnapshotCount number

    The maximum number of snapshots that can be created as a backup.

    rdbStorageConnectionString string

    The Connection String to the Storage Account. Only supported for Premium SKUs.

    aof_backup_enabled bool
    aof_storage_connection_string0 str
    aof_storage_connection_string1 str
    enable_authentication bool

    Specifies if authentication is enabled

    maxclients int
    maxfragmentationmemory_reserved int

    Value in megabytes reserved to accommodate for memory fragmentation.

    maxmemory_delta int

    The max-memory delta for this Redis instance.

    maxmemory_policy str

    How Redis will select what to remove when maxmemory is reached.

    maxmemory_reserved int

    The value in megabytes reserved for non-cache usage e.g. failover

    notify_keyspace_events str
    rdb_backup_enabled bool

    Is Backup Enabled? Only supported on Premium SKUs.

    rdb_backup_frequency int

    The Backup Frequency in Minutes. Only supported on Premium SKUs.

    rdb_backup_max_snapshot_count int

    The maximum number of snapshots that can be created as a backup.

    rdb_storage_connection_string str

    The Connection String to the Storage Account. Only supported for Premium SKUs.

    aofBackupEnabled Boolean
    aofStorageConnectionString0 String
    aofStorageConnectionString1 String
    enableAuthentication Boolean

    Specifies if authentication is enabled

    maxclients Number
    maxfragmentationmemoryReserved Number

    Value in megabytes reserved to accommodate for memory fragmentation.

    maxmemoryDelta Number

    The max-memory delta for this Redis instance.

    maxmemoryPolicy String

    How Redis will select what to remove when maxmemory is reached.

    maxmemoryReserved Number

    The value in megabytes reserved for non-cache usage e.g. failover

    notifyKeyspaceEvents String
    rdbBackupEnabled Boolean

    Is Backup Enabled? Only supported on Premium SKUs.

    rdbBackupFrequency Number

    The Backup Frequency in Minutes. Only supported on Premium SKUs.

    rdbBackupMaxSnapshotCount Number

    The maximum number of snapshots that can be created as a backup.

    rdbStorageConnectionString String

    The Connection String to the Storage Account. Only supported for Premium SKUs.

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes

    This Pulumi package is based on the azurerm Terraform Provider.

    azure logo

    We recommend using Azure Native.

    Azure Classic v5.49.0 published on Tuesday, Aug 29, 2023 by Pulumi