frumbert
frumbert

Reputation: 2427

phpfastcache V6 + redis - possible to set prefix?

When I talk to redis directly I can use Redis::OPT_PREFIX to ensure i'm not overwriting keys. e.g. namespacing ..

    $redis = new Redis();
    if ($redis->connect('127.0.0.1', 6379)) {
        $redis->setOption(Redis::OPT_PREFIX, 'FooBar9000:');
        if ($redis->exists($hash)) {

I'm also using phpFastCache V6 connecting to the Redis driver into which you can throw a config:

$InstanceCache = CacheManager::getInstance('redis', new Config([
 'host' => '127.0.0.1', //Default value
 'port' => 6379, //Default value
 'password' => null, //Default value
 'database' => null, //Default value
]));

but I can seem to see how I can set options on that driver?

Upvotes: 0

Views: 480

Answers (1)

Geolim4
Geolim4

Reputation: 454

Yes and no...

This is natively not possible but as of the v7 you can provide your own Redis client: https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV4%CB%96%5D-Configuration-Options#redispredis-specific-options

So in the meantime that they add the support for this option you can make use of your own Redis client.

Upvotes: 0

Related Questions