Search code examples
phpredisphpredis

phpRedis - How to push/get key from another namespace?


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?


Solution

  • 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');