Memcached php add vs set performance -
new php memcahed library in php. wondering major difference between memcached::add , memcached::set are? both have same performance on head , advantage of using 1 on other?
another thing these methods (::set , ::add) feature sort of safe addition? meaning, if key doesnt exist in memcache creates it, or if key exist replace it? want minimize duplicate keys. , way can create sort of safe adding replacing first checking if success, else create it.
the difference documented on memcached::add:
memcached::add() similar memcached::set(), operation fails if key exists on server.
memcached::add()
return false if key defined, meaning that's should use if want report error duplicate key. additionally, use memcached::getresultcode() check if add successful.
for performance comparisons, may depend on number of memcached servers, library versions , number of factors specific application. premature optimisation, if still want compare, best bet benchmark own set-up.
Comments
Post a Comment