PHP code example of bigoen / redis-bundle

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

    

bigoen / redis-bundle example snippets


use Bigoen\RedisBundle\Utils\RedisHelper;

// create from dsn.
$helper = new RedisHelper('redis://127.0.0.1/1');
// set and add namespaces.
$helper->setNamespace("test");
$helper->addNamespace("sub");
// create redis.
$redis = $helper->getRedis();

use Bigoen\RedisBundle\Utils\RedisClientHelper;

class TestController
{
    public function __invoke(RedisClientHelper $helper)
    {
        // create redis.
        $redis = $helper->setClient("doctrine_query_cache")->createRedis();
        // get namespace or other client parameters.
        $namespace = $helper->getParameter('namespace');
        $redis->set("{$namespace}:key", "test");
    }
}