This library provides a layer to a key value redis store.
It uses the predis/predis package.
Check out the abstract library to see the other adapters and the Api.
Install it through composer.
{
"require": {
"adammbalogh/key-value-store-redis": "@stable"
}
}
tip: you should browse the adammbalogh/key-value-store-redis
page to choose a stable version to use, avoid the @stable
meta constraint.
<?php
use AdammBalogh\KeyValueStore\KeyValueStore;
use AdammBalogh\KeyValueStore\Adapter\RedisAdapter as Adapter;
use Predis\Client as RedisClient;
$redisClient = new RedisClient();
$adapter = new Adapter($redisClient);
$kvs = new KeyValueStore($adapter);
$kvs->set('sample_key', 'Sample value');
$kvs->get('sample_key');
$kvs->delete('sample_key');
Please visit the API link in the abstract library.
Key | Value | Server |
---|---|---|
✔ delete | ✔ get | ✔ flush |
✔ expire | ✔ set | |
✔ getTtl | ||
✔ has | ||
✔ persist |