Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the point of replace function in Memcache?

Tags:

php

memcached

What is the point of replace function in PHP memcache if you can just use set? Even if there is a variable, set automatically replaces it, right?

Can you give me an example where it's better to use replace instead of set?

Thanks.

like image 286
good_evening Avatar asked Dec 17 '22 14:12

good_evening


1 Answers

According to PHP.net:

Memcached::replace() is similar to Memcached::set(), but the operation fails if the key does not exist on the server.

like image 172
ZoFreX Avatar answered Jan 07 '23 01:01

ZoFreX