PHP code example of naroga / redis-cache

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

    

naroga / redis-cache example snippets




aroga\RedisCache\Redis;
use Predis\Client;

$config = array(
    'scheme' => 'tcp',
    'host' => 'localhost',
    'port' => 6379
);

$redis = new Redis(new Client($config));

if (!$redis->has('myKey')) {
    $redis->set('myKey', 'myValue', 1800); //Just call any PSR-16 methods here.
}