Registry

Skynet offers database registry to quick and easy store any data. Data in registry is stored by key-value pairs structure and every Event Listener has access to this registry.
You can use registry to store any data, after that you can send this data via request or use it stored data in response.

To store any value in registry use command:

@reg_set foo:"bar";

where foo is the key, and bar is the value

To receive stored registry value from remote cluster, use:

@reg_get foo;

After request will be sent, value of the key foo will be returned in response.

You can store multiple values at once, by separating them by coma ",".

Examples:

@reg_set foo:"bar", foo2:"bar2", foo3:"bar3";

@reg_get foo, foo2;

To store value in cluster's its own registry, use this code in event listener:

/src/SkynetUser/MyListener.php:
public function onRequest($context)
{
if($context == "beforeSend")
{
$this->reg_set('foo', 'bar');
}
}

To get value from registry use:

/src/SkynetUser/MyListener.php:
public function onRequest($context)
{
if($context == "beforeSend")
{
$foo = $this->reg_get('foo');
}
}

Of course, you can use all of this in every event, not only in onRequest().

If you want to set/ or get values from specified clusters you must mix request with @to command:

@reg_set foo:"bar";
@to "CLUSTER_ADDRESS";
Full API Documentation is included in Skynet packages available on GitHub.