redis Storage Engine
Every Apex installation comes with the redis storage engine available which is a blazingly fast in-memory storage engine and excellent for things such as cached items, authenticated sessions, and any other dynamic data that needs to be accessed and stored quickly without making a query to the SQL database.
Every request will connect to redis, and you may access the redis connection via attribute injection, for example:
<?php
namespace App\MyPackage;
use redis;
/**
* Some class
*/
class SomeClass
{
#[Inject(redis::class)]
private redis $redis;
/**
* Process
*/
public function process(string $Name):void
{
$this->redis->set('test_name', $name);
$chk_name = $this->redis->get('test_name');
echo "Name is: $chk_name\n":
}
}
If you are not already familiar with redis, please visit the redis Data Types section of their web site to view a list of all supported data types and their associated functions.