Share via


New-Cache

New-Cache

Creates a new named cache when the cluster is running. All values except for CacheName are optional.

Syntax

Parameter Set: Default
New-Cache [-CacheName] <String> [-Eviction <String> ] [-Expirable <String> ] [-Force] [-NotificationsEnabled <String> ] [-Secondaries <Int32> ] [-TimeToLive <Int64> ] [ <CommonParameters>]

Parameters

-CacheName<String>

The name of the cache.

Aliases

none

Required?

true

Position?

1

Default Value

The name of the cache.

Accept Pipeline Input?

false

Accept Wildcard Characters?

-Eviction<String>

The default value of LRU enables Least Recently Used eviction. A value of None disables eviction. Warning: a value of None may cause a cache host to run out of memory.

LRU
None

Aliases

none

Required?

false

Position?

named

Default Value

LRU

Accept Pipeline Input?

false

Accept Wildcard Characters?

-Expirable<String>

Specifies whether items in the cache are expirable. By default, this is set to true.

true
false

Aliases

none

Required?

false

Position?

named

Default Value

true

Accept Pipeline Input?

false

Accept Wildcard Characters?

-Force

Performs the operation without prompting the user. This only applies when the Secondaries parameter is set to a value of 1.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

-NotificationsEnabled<String>

Use this parameter to enable notifications on the cache. Notifications are disabled by default.

true
false

Aliases

none

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

-Secondaries<Int32>

A value of 1 enables the high availability feature. A value of 0 disables the high availability feature. The default value is 0.

1
0

Aliases

none

Required?

false

Position?

named

Default Value

0

Accept Pipeline Input?

false

Accept Wildcard Characters?

-TimeToLive<Int64>

The expiration timeout minutes for items in the cache.

Aliases

none

Required?

false

Position?

named

Default Value

10

Accept Pipeline Input?

false

Accept Wildcard Characters?

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters

Examples

------------------------ EXAMPLE 1 ------------------------

Creates a cache with default properties. Cache created in this manner will have the same properties as the built-in default cache.

New-Cache -CacheName myCacheName

------------------------ EXAMPLE 2 ------------------------

Creates a custom configured cache.

New-Cache -CacheName myCacheName -TimeToLive 8 -Expirable false

Get-Cache
Remove-Cache