PHP code example of earc / data-redis

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

    

earc / data-redis example snippets


use eArc\Data\Initializer;

Initializer::init();

use eArc\Data\ParameterInterface;
use eArc\DataRedis\RedisDataBridge;

// The order of the on load tagging is important!
di_tag(ParameterInterface::TAG_ON_LOAD, RedisDataBridge::class);
di_tag(ParameterInterface::TAG_ON_LOAD, MyDatabaseBridge::class);

di_tag(ParameterInterface::TAG_ON_PERSIST, RedisDataBridge::class);
di_tag(ParameterInterface::TAG_ON_PERSIST, MyDatabaseBridge::class);

di_tag(ParameterInterface::TAG_ON_REMOVE, RedisDataBridge::class);
di_tag(ParameterInterface::TAG_ON_REMOVE, MyDatabaseBridge::class);

use eArc\DataRedis\ParameterInterface;

di_set_param(ParameterInterface::REDIS_CONNECTION, ['127.0.0.1', 6379]);

use eArc\DataRedis\ParameterInterface;

di_set_param(ParameterInterface::HASH_KEY_PREFIX, 'some-hash-key-prefix');