New-Cache
Note
This feature is only available in NCache Enterprise and NCache Professional.
New-Cache
cmdlet enables the user to create a new cache on one or more server
nodes. New cache can be formed by user specified configurations in a config file
placed on the path provided by the user if the user doesn’t want to use the
default configurations.
You can create a cache with the following topologies:
Local
Mirror
(Enterprise Edition only)Replicated
Partitioned
PartitionedOfReplica
(Enterprise Edition only)
New-Cache [-Name] [-Server] [-CleanupInterval] [-ClusterPort] [-DefaultPriority] [-EvictionPolicy] [-EvictionRatio] [-Inproc] [-SerializationFormat] [-NoLogo] [-Password] [-Path] [-Port] [-ReplicationStrategy] [-Size] -Topology [-UserId]
These properties are explained in detail in the Properties section.
Examples
- This command creates a new cache named demoCache on server 20.200.20.11 of size of 1024 MB and uses local topology since no topology is specified by the user.
New-Cache -Name demoCache -Server 20.200.20.11 -Size 1024
- This command creates a new cache named demoCache on server 20.200.20.11 having the size of 1024 MB, uses local topology since no topology is specified by the user and the configuration existing on the specified path.
New-Cache -Name demoCache -Server 20.200.20.11 –Path C:\config.xml
- This command creates a new cache named demoCache on server 20.200.20.11 topology chosen as replicated and occupying the port number 8701.
New-Cache -Name demoCache -Server 20.200.20.11 -Size 1024 –Topology Replicated –ClusterPort 8701
- This command creates a new cache named demoCache on server 20.200.20.11 having the size of 1024 MB, topology as Partitioned, eviction policy set as priority based and priority set as high as well as eviction ratio set as 10%. The cleanup interval of the cache will be 20 seconds.
New-Cache demoCache -Server 20.200.20.11 -Size 1024 –Topology Partitioned –EvictionPolicy priority –DefaultPriority high –EvictionRatio 10 –CleanupInterval 20
Properties
Note: The parameters with asterisk (*) on their names are the required parameters and the rest are optional.
Parameters | Data Types | Description | Default Value |
---|---|---|---|
-Name* |
<String> |
Specifies the name of the new cache that is to be registered. | - |
-Server* |
<String> |
Specifies the NCache server names/IPs where Cache should be configured, separated by commas e.g 20.200.20.11, 20.200.20.12. | - |
-Inproc |
<SwitchParamter> |
Specifies the Isolation level for local cache. | False |
-SerializationFormat |
<SwitchParamter> |
Specifies the serialization format of the objects stored in the cache. Possible values are |
Binary |
-Port |
<Integer> |
Specifies the server port where NCache server is listening. | 8250 |
-Size |
<Long> |
Specifies the size of the Cache that is to be newly created. | 1024 (For Local Cache) |
-EvictionPolicy |
<String> |
Specifies the eviction policy for cache items. Cached items will be cleared from the cache according to the specified policy if the cache reaches its limit. Possible values are NOTE: LRU and LFU are only available in Enterprise edition. |
LRU |
-EvictionRatio |
<Decimal> |
Specifies the eviction ratio (Percentage) for cache items. Cached items will be cleared from the cache according to the specified ratio if the cache reaches its limit. | 5% |
-CleanupInterval |
<Integer> |
Specifies the time interval in seconds after which cache cleanup is called and all the expired items are cleared from the cache. | 15 seconds |
-Topology |
<String> |
Specifies the topology If the user is using a topology other than local topology. The user is supposed to provide the topology and Cluster port. Possible topologies are Mirror Replicated Partitioned PartitionedOfReplica NOTE: Mirror and PartitionedOfReplica are only available in Enterprise edition. |
- |
-ReplicationStrategy |
<String> |
If the topology chosen by the user is Partitioned Replica; this parameter specifies the replication strategy. The possible values are |
Async |
-ClusterPort |
<Integer> |
Specifies the port of the server, at which server listens. | - |
-DefaultPriority |
<String> |
If the eviction policy opted by the user is Priority based; this parameter specifies the default priority. Possible values are |
Normal |
-Path |
<String> |
Specifies the path of the configuration file if the user doesn’t want to use the default configurations. A sample xml config file has been mentioned below. | - |
-UserId (Enterprise edition only) |
<String> |
Specifies the User Id used to authorize a user if security is enabled on cache server. This User Id must be the same as the active directory user credentials. | - |
-Password (Enterprise edition only) |
<String> |
Specifies the password against the user Id; to authorize a user if security is enabled on cache server. This password must be the same as active directory password. | - |
-NoLogo |
<SwitchParameter> |
Suppresses display of the logo banner. | False |
This is a sample configuration file. On specifying the path of this .xml file; newly created cache will use the configurations as per this file.
<configuration>
<cache-config>
<cache-settings inproc="False" last-modified="" auto-start="False"
data-format="Binary">
<logging enable-logs="True" trace-errors="True" trace-notices="False"
trace-warnings="False" trace-debug="False" log-path=""/>
<performance-counters enable-counters="True" snmp-port="0"/>
<data-load-balancing enabled="False"
auto-balancing-threshold="60%"
auto-balancing-interval="30sec"/>
<compression enable-compression="False" threshold="100kb"/>
<client-death-detection/>
<client-activity-notification enabled="False" retention-period="5sec"/>
<cache-notifications item-remove="False" item-add="False"
item-update="False"/>
<cleanup interval="35sec"/>
<storage type="heap" cache-size="2048mb"/>
<eviction-policy enabled-eviction="True" default-priority="normal"
policy="lru" eviction-ratio="10%"/>
<expiration-policy enabled="True">
<absolute-expiration longer-enabled="False" longer-value="0"
default-enabled="False" default-value="0"/>
<sliding-expiration longer-enabled="False" longer-value="0"
default-enabled="False" default-value="0"/>
</expiration-policy>
<cache-topology topology="partitioned-replica">
<cluster-settings operation-timeout="60sec" stats-repl-interval="60sec"
use-heart-beat="False">
<data-replication synchronous="False"/>
<cluster-connection-settings cluster-port="7802" port-range="2"
connection-retries="2"
connection-retry-interval="2secs"
join_retry_count="24"
join_retry_timeout="5"/>
</cluster-settings>
</cache-topology>
<tasks-config max-tasks="10" chunk-size="100" communicate-stats="False"
queue-size="10" max-avoidable-exceptions="10"/>
</cache-settings>
<cache-deployment deployment-version="1">
<client-nodes client-cache-name="demoClientCache">
<client-node client-cache-status="unavailable" ip="20.200.20.38"/>
</client-nodes>
<servers>
<server-node ip="20.200.20.29" active-mirror-node="False"/>
</servers>
</cache-deployment>
</cache-config>
</configuration>