June 2017
Intermediate to advanced
536 pages
9h 49m
English
Updating a value via the Redis client is the same as inserting it. We use the same set() method, with the same key. The new value simply overwrites the previous one, if any exists:
<?phptry { $client = new Redis(); $client->connect('localhost', 6379); $client->set('test', 'test1'); $client->set('test', 'test2'); // $client->get('test'); // returns string containing "test2" chars} catch (RedisException $e) { echo $e->getMessage(), PHP_EOL;}