Create a store
Create a key-value store in the portal — name and placement, compute plan and memory, eviction policy, cache size limit and password — or with the CLI.
Requires: valkey/write
Creating a store needs the valkey/write permission in the resource group; the Owner, Contributor
and Databases Operator roles have it.
Open the wizard
In the portal at https://portal.example.com, open Key-Value Store in the sidebar and choose Create Key-Value Stores. The Create key-value store wizard has four steps: Basics, Size, Cache behaviour and Review. Next checks a step before it moves on, and Submit on the last step creates the store.
Basics
- Cache name — 3 to 50 characters: lowercase letters, digits and hyphens, not starting or ending with a hyphen, and unique in the resource group. It is also the store's in-cluster host name, and cannot be changed later.
- Boundary, Cluster and Resource group — where the store runs. Each is filled in for you when there is only one choice.
Size
- Compute plan — how much CPU and memory the store gets; each card shows the plan's name, CPU and memory. The memory decides how much the cache can hold — see Compute plans. A plan this installation's nodes cannot host is shown with the reason and cannot be chosen, and when the boundary restricts which plans may be used, the others cannot be chosen either.
- Advanced — CPU request, Memory request, CPU limit and Memory limit, filled in from the plan. The cache size limit is derived from the memory limit.
Cache behaviour
The step opens with a notice: the store keeps no data across a restart, and stopping or restarting it discards everything it holds.
- Eviction policy — what the store removes when the cache is full. The default,
allkeys-lru, evicts the least recently used key;noevictionreturns errors on writes instead. The policies are listed in Eviction policies. It can be changed later without a restart. - Cache size limit — leave it empty, and the platform derives it from the memory limit, keeping
a quarter of the memory for the server itself. To set it, write a number with an optional unit,
such as
512mbor2gb. Keep it well below the memory limit: at the limit, the server runs out of memory instead of evicting. - Require a password — on by default, and recommended: clients must authenticate before they send commands. The platform generates the password.
Review
Review shows the name, resource group, compute plan and memory limit, the eviction policy, the cache size limit, whether a password is required, and Durability: Not persisted. Submit creates the store and returns to the list. The store is Creating until the server accepts connections, and then Running. Follow it on the store's Operations tab — see Operations.
With the CLI
stsh valkeys create my-cache -g my-resource-group -c my-cluster --set computePlan=small
stsh valkeys create sessions -g my-resource-group -c my-cluster \
--set computePlan=medium --set maxMemoryPolicy=allkeys-lfuWithout other settings a store requires a password and uses allkeys-lru. A store created without a
plan gets 0.1–0.5 CPU and 256 MiB of memory requested with a 512 MiB limit.