1. Go to this page and download the library: Download decodelabs/stash 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/ */
interface Config
{
public function getDriverFor(string $namespace): ?string;
public function isDriverEnabled(string $driver): bool;
public function getAllDrivers(): array;
public function getDriverSettings(string $driver): ?array;
public function getPileUpPolicy(string $namespace): ?PileUpPolicy;
public function getPreemptTime(string $namespace): ?int;
public function getSleepTime(string $namespace): ?int;
public function getSleepAttempts(string $namespace): ?int;
}
Stash::setConfig(new MyConfig());
namespace MyApp;
use DecodeLabs\Archetype;
use DecodeLabs\Stash\Store;
use DecodeLabs\Stash\Store\Generic;
class MyCache extends Generic
{
public function getMyData(): string
{
return $this->fetch('myData', function() {
return 'Hello world';
});
}
}
Archetype::map(Store::class, namespace::class);
$myCache = Stash::load('MyCache'); // Will now use MyApp\MyCache
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.