PHP code example of axetools / cachingtrait

1. Go to this page and download the library: Download axetools/cachingtrait library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

axetools / cachingtrait example snippets



namespace test

use AxeTools\Trait\Caching\CachingTrait;

class HardToBuild {

use CachingTrait;

    /**
     * @param array<string> $parameters Assumes that the parameters alone can uniquely recall the same object.
     */
    public static function create(array $parameters){
        if(self::hasCache(parameters)) return self::getCache($parameters);
        return new self($parameters);
    }
    
}

self::setCache(array<string> $key, mixed $data): void

self::hasCache(array<string> $key): bool

self::getCache(array<string> $key): mixed

self::clearCache(array<string> $key): void