PHP code example of andrewdyer / predis-adaptor

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

    

andrewdyer / predis-adaptor example snippets




$cache = new Anddye\PredisAdaptor\Cache([
    'host'      => '',
    'password'  => '',
    'port'      => '',
    'scheme'    => '',
]);

$cache->delete('my_key');
unset($cache->my_key);
unset($cache['my_key'])

$bool = $cache->exists('my_key');
$bool = isset($cache->my_key);

$value = $cache->get('my_key');
$value = $cache->my_key;

$cache->put('my_key', 'my_value');
$cache->my_key = 'my_value';

$value = $cache->remember('my_key', 10, function () {
    return 'my_value';
});