New-ClientCache
This PowerShell cmdlet configures a Client Cache (L1 Cache) for an existing clustered cache (L2). The Client Cache configuration is maintained on the cache server and is automatically provided to client applications when they connect to the cache. A cache can have one Client Cache configuration. The Client Cache name is derived automatically from the clustered cache name. For example, the Client Cache configured for defaultCache is named defaultCache_cc. You can configure a Regular or Full-Data Client Cache and specify whether it runs InProc or OutProc. For a Full-Data Client Cache, reference data types can be configured using the Add-ClientCacheRefDataType cmdlet.
Note
Creating a Client Cache does not automatically initialize it in application processes that were already connected without Client Cache. Restart those application processes to initialize the newly configured Client Cache.
New-ClientCache -CacheName -Server `
[-Type] [-Size] `
[-InProc] [-FailQueryOnPartialDataset] `
[-DisableL2FallbackOnMiss] [-DataReloadThreshold] `
[-CleanupInterval] [-Eviction] `
[-Port] [-Credentials] `
[-TlsCertPath] [-TlsCertPassword] `
[-NoLogo]
Important
A Full-Data Client Cache cannot be created while the clustered cache is running.
Examples
- This command configures a Regular Client Cache for defaultCache on server 20.200.20.11 with a size of 1024 MB. If the
Typeparameter is not specified, a Regular Client Cache is configured by default.
New-ClientCache -CacheName defaultCache -Server 20.200.20.11 -Size 1024
- This command configures a Full-Data Client Cache for defaultCache on server 20.200.20.11 with a size of 1024 MB.
New-ClientCache -CacheName defaultCache -Server 20.200.20.11 `
-Type FullData -Size 1024
- This command configures an InProc Regular Client Cache for defaultCache.
New-ClientCache -CacheName defaultCache -Server 20.200.20.11 `
-InProc -Size 1024
- This command configures a Client Cache with a clean interval of 30 seconds and disables eviction.
New-ClientCache -CacheName defaultCache -Server 20.200.20.11 `
-CleanupInterval 30 -Eviction false
- This command configures a Full-Data Client Cache for defaultCache on server 20.200.20.11. The client cache is configured with 1024 MB of memory. The
FailQueryOnPartialDatasetswitch parameter enforces Strict Query Enforcement and throws an exception if a query is executed on a partially loaded dataset, with no fallback to the clustered cache. TheDisableL2FallbackOnMissswitch parameter enforces Strict Local Reads and returns a cache miss for any key not found in the client cache, without attempting to retrieve it from the clustered cache.
New-ClientCache -CacheName defaultCache -Type FullData `
-Server 20.200.20.11 -Size 1024 `
-FailQueryOnPartialDataset -DisableL2FallbackOnMiss
- This command configures a Regular Client Cache for defaultCache on server 20.200.20.11 having size 1024 MB using security credentials.
New-ClientCache -CacheName defaultCache -Server 20.200.20.11 `
-Size 1024 -Credentials(Get-Credential john_smith)
- This command configures a Regular Client Cache for defaultCache on server 20.200.20.11 using a client PEM certificate and password for mutual TLS (mTLS) authentication.
New-ClientCache -CacheName defaultCache -Server 20.200.20.11 `
-Size 1024 -TlsCertPath "C:\certs\client.pem" `
-TlsCertPassword "clientKeyPassword"
Properties
Note
The parameters with asterisk (*) on their names are the required parameters and the rest are optional.
| Parameters | Data Types | Description | Default Value |
|---|---|---|---|
-CacheName* |
<String> |
Specifies the name of the clustered cache for which the Client Cache is configured. | - |
-Server* |
<String> |
Specifies a server name where the NCache Service is running and a cache with the specified cache-name is registered. | - |
-Type |
<String> |
Specifies the type of the Client Cache. The possible values are: - Regular - FullData |
Regular |
-Size |
<Long> |
Specifies the maximum size of the Client Cache in MB. | 1024 MB |
-InProc |
<SwitchParameter> |
Specifies if the Client Cache needs to be InProc or OutProc. If not specified the Client Cache will be OutProc by default. | False |
-FailQueryOnPartialDataset |
<SwitchParameter> |
Throws an exception when querying a partially loaded dataset in the Full-Data Client Cache, with no fallback to the clustered cache. | False |
-DisableL2FallbackOnMiss |
<SwitchParameter> |
Full-Data only. Prevents fallback to the clustered cache when an item from a reference dataset is not found in the Client Cache. | False |
-DataReloadThreshold |
<Integer> |
Specifies the minimum percentage of free Client Cache capacity required before NCache attempts to reload evicted reference data. This parameter applies only to Full-Data Client Cache. | 20 |
-CleanupInterval |
<Integer> |
Specifies the time interval (in seconds) after which the cache cleanup is called. | 15 seconds |
-Eviction |
<String> |
Specifies whether eviction is enabled (true) or disabled (false) for a Regular Client Cache. Eviction is always enabled for a Full-Data Client Cache. |
true |
-Port |
<Integer> |
Specifies the server port where NCache Service is listening. | 9803 |
-Credentials |
<pscredential> |
Specifies the user credentials used to authorize the user for this operation. It is required in case security is enabled on cache server. The password must be the same as the active directory user password. The user id must be the same as the active directory user id. | - |
-TlsCertPath |
<String> |
Specifies the path to a client PEM certificate for mTLS authentication. The PEM file must contain the private key, leaf certificate, and any intermediate certificates. This is required when running the PowerShell module from a machine without NCache installed and connecting to a server that requires mTLS. On an NCache server installation, the node's own certificate is used automatically. Relative paths are resolved from the current PowerShell location. A certificate can be generated using New-NCacheTlsCertificate. |
- |
-TlsCertPassword |
<String> |
Specifies the password for the encrypted private key in the PEM file provided through -TlsCertPath. Omit this parameter if the private key is not encrypted. The password is used only for the current command and is not saved in the NCache server configuration. |
- |
-NoLogo |
<SwitchParameter> |
Suppresses display of the logo banner. | False |