PHP code example of adammbalogh / key-value-store-replicator
1. Go to this page and download the library: Download adammbalogh/key-value-store-replicator 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/ */
adammbalogh / key-value-store-replicator example snippets
use AdammBalogh\KeyValueStore\KeyValueStore;
use AdammBalogh\KeyValueStore\Adapter\MemcachedAdapter;
use AdammBalogh\KeyValueStore\Adapter\RedisAdapter;
use AdammBalogh\KeyValueStore\Adapter\ReplicatorAdapter;
$sourceAdapter = new MemcachedAdapter(new Memcached());
$replicaAdapter = new RedisAdapter(new Predis\Client());
$adapter = new ReplicatorAdapter($sourceAdapter, $replicaAdapter);
$kvs = new KeyValueStore($adapter);
$kvs->set('sample_key', 'Sample value');
$kvs->get('sample_key');
$kvs->delete('sample_key');