PHP code example of quillphp / cache

1. Go to this page and download the library: Download quillphp/cache 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/ */

    

quillphp / cache example snippets


use Quill\Cache\CacheManager;
use Quill\Cache\ArrayDriver;

$cache = new CacheManager('array');
$cache->addDriver('array', new ArrayDriver());

$cache->set('key', 'value', 3600);
$value = $cache->get('key');

use Quill\Cache\CacheServiceProvider;

$app = new \Quill\App();

CacheServiceProvider::register($app, [
    'driver' => 'file',
    'path'   => __DIR__ . '/storage/cache',
    'prefix' => 'my_app:'
]);

// Access via DI in handlers:
$app->get('/data', function(\Quill\Cache\CacheManager $cache) {
    return $cache->get('some_data');
});

$driver = new \Quill\Cache\FileDriver(__DIR__ . '/cache');

$driver = new \Quill\Cache\ApcuDriver('prefix:');

$redis = new \Redis();
$redis->connect('127.0.0.1');

$driver = new \Quill\Cache\RedisDriver($redis, 'prefix:');