Caching

Apex utilizes the PSR6 standard for caching, and by default with installation uses the Symfony Cache component. If desired, you can easily switch out Symfony Cache for another PSR6 compliant cache. Simply open the /boot/container.php file and look for the lines:

    cacheInterface::class => function() {
        $psr6cache = Di::get(CacheItemPoolInterface::class);
        return new Psr16Cache($psr6cache);
    },

Change that entry to anything you wish as long as it's PSR6 compliant. The cache component is available via the Apex\Svc\Cache class, for example:

<?php

namespace App\MyPackage;

use Apex\Svc\Cache;

class MyClass
{

    #[Inject(Cache::class)]
    private Cache $cache;

    /**
     * Process
     */
    public function process():void
    {
        $this->cache->set('my_key', 'my_value');
    }
}

For full details on how the cache component works, please consult the Symfony Cache documentation.

For full details on the PSR6 cache standard, please consult the PSR6 Caching Standard guideline.