0

I have one database (db0) and 2 namespaces: space1, space2.
For my code I'm using phpRedis (https://github.com/phpredis/phpredis) library.
Example "string": space1_:main_site_products:77-005_expire.
How can I get this key from space2? Or how can I put key to another space?

Paul
  • 411
  • 6
  • 15

1 Answers1

1

Probably you must create a new connection to server with option (2nd parameter) prefix setted to space1_, then get your key by $redisSpace1->get('main_site_products:77-005_expire');

Vertisan
  • 720
  • 3
  • 14
  • 34
  • So I'm create connection via `$redisSpace1 = new \Predis\Client(['port' => 12769, 'password' => 'redisServer']);` but where enter this `2nd parameter`? – Paul Apr 16 '19 at 07:48
  • 1
    As we both wrote - 2nd parameter in connection. So your connection will be `$redisSpace1 = new \Predis\Client(['port' => 12769, 'password' => 'redisServer'], ['prefix' => 'space1_']);`. First array had connection parameters like host, password, etc. and second has connection OPTIONS like prefix. More in docs: https://github.com/nrk/predis/wiki/Home – Vertisan Apr 16 '19 at 07:55
  • Ohh... My mistake, I didn't see it. Thanks! That's solving my problem :) – Paul Apr 16 '19 at 08:08