-
This is a sample code connecting to Redis using relay with its PSR16 cache implementation. <?php
require_once __DIR__ . '/vendor/autoload.php';
use Relay\Relay;
use CacheWerk\Relay\Psr\SimpleCache\RelayCache;
$relay = new Relay;
$relay->connect('127.0.0.1', 6379);
echo $relay->get('some:key') . "\n"; // This line works
$cache = new RelayCache($relay);
echo $cache->get('some:key') . "\n"; // This gives 'not connected' error This is the full error:
So, How am I supposed to construct the RelayCache instance? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
@michael-grunder Can you elaborate on |
Beta Was this translation helpful? Give feedback.
-
That error generally happens when we try to read data from Redis when not connected at all. For example this would cause it: $relay = new \Relay\Relay;
$relay->get('foo'); So my guess is that the adapter isn't doing any sort of connection before trying to use it. I'll see if I can replicate the behavior locally. |
Beta Was this translation helpful? Give feedback.
Hehe, no worries. We've fixed the issue: #131