<a id="halonctl-script"></a>

<a id="script-engine"></a>

# Script engine

These sub-commands can work on various parts of the Halon [script](https://docs.halon.io/hsl/archive/6.12-stable/) engine.
The actual script is managed via the [configuration](cli_config.html.md#cli-config) commands.

<a id="cli-shm"></a>

<a id="shared-memory-functions"></a>

## Shared memory functions

These sub-commands can store, list, fetch and delete key/value pairs from the
the [script](https://docs.halon.io/hsl/archive/6.12-stable/) engine’s
[shared memory](https://docs.halon.io/hsl/archive/6.12-stable/functions.html#shared-memory) API.
In order to be able to work with complex Halon [script](https://docs.halon.io/hsl/archive/6.12-stable/) data structures,
the values are JSON encoded.

```console
$ halonctl hsl memory store theanswer 42
$ halonctl hsl memory list
theanswer
$ halonctl hsl memory fetch theanswer
42
$ halonctl hsl memory delete theanswer
```

<a id="cli-cache"></a>

<a id="cache-statement"></a>

## Cache statement

These sub-commands can list and clear the [script](https://docs.halon.io/hsl/archive/6.12-stable/) engine’s
[function cache](https://docs.halon.io/hsl/archive/6.12-stable/structures.html#cache)
buckets.

```console
$ halonctl hsl cache list
┌───────────┬──────────────────┬──────────┬──────┬────────┬────────┬────────┬──────────┐
│ Namespace │ Function         │ Max size │ Size │   Hits │ Misses │ Evicts │ Hit rate │
├───────────┼──────────────────┼──────────┼──────┼────────┼────────┼────────┼──────────┤
│           │ api_call_http    │   100000 │  845 │ 122799 │   6041 │      0 │  95.3112 │
│           │ http             │    16384 │  747 │   5670 │   2850 │      0 │  66.5493 │
│ test      │ smtp_lookup_rcpt │    16384 │    2 │      1 │     31 │      0 │    3.125 │
└───────────┴──────────────────┴──────────┴──────┴────────┴────────┴────────┴──────────╯
$ halonctl hsl cache clear --function http
1 buckets cleared
```
