[cache.set]
cache.set is a slot in the cache namespace, in Hyperlambda, the language of Magic Cloud. Stores a value in the in-memory cache under a key, with an optional sliding expiration.
- Value (
cache-key), required: Cache key to store
Arguments
Required arguments come first, then the optional ones in the order they are declared.
| Argument | Type | Required | Description |
|---|---|---|---|
[value] |
string | no | Value to store; omitted or null removes the cached item. |
[expiration] |
long | no | Expiration in seconds. Default: 5. |
Guide: How to use [cache.set]
JSON declaration
This is the complete declaration of cache.set, as the running system describes it. It is also published as slot.json.
JSON declaration
{
"name": "cache.set",
"description": "Stores a value in the in-memory cache under a key, with an optional sliding expiration",
"signature": {
"input": {
"kind": "cache-key",
"description": "Cache key to store",
"required": true,
"mode": "ValueOrExpression"
},
"children": {
"value": {
"type": "string",
"kind": "cache-value,text",
"description": "Value to store; omitted or null removes the cached item",
"required": false,
"mode": "ValueOrExpression",
"cardinality": "ZeroOrOne",
"role": "Option",
"projection": "Value"
},
"expiration": {
"type": "long",
"kind": "duration-seconds",
"description": "Expiration in seconds",
"required": false,
"mode": "ValueOrExpression",
"cardinality": "ZeroOrOne",
"default": "5",
"role": "Option",
"projection": "Value"
}
}
}
}
← cache.list |
all cache.* slots |
cache.try-get → |