include "vendor/autoload.php"; /** * This example shows how to create a connection and then query for a key, * set data and then retrieve the data. */ /** * Create the redis object and initialise a connection. */ $helper = new RedisHelper\RedisHelper(); $helper->connect(true, 'localhost', 6379, ''); $ourKey = "example_key"; /** * So if the key does not exist, lets store some data with that key. */ if ($helper->exists($ourKey) === false) { $helper->set($ourKey, 'This is our test data'); } /** * And now lets check if that key now exists. */ if ($helper->exists($ourKey) === true) { echo $helper->get($ourKey) . "\n"; } /** * Re-initialise the helper object and start from fresh to * absolutely 100% ensure that our data was saved to redis. */ $helper = new RedisHelper\RedisHelper(); $helper->connect(true, 'localhost', 6379, ''); echo $helper->get($ourKey) . "\n";