People who have used memcache have a doubt, that is why there is a memcache in the Add method, a set method, a replace, these methods have what kind of difference, below we analyze the differences between these methods:
Memcache::add method: The Add method is used to add a data to the Memcache server to be cached.
Memcache::set method: The Set method is used to set the cached content of a specified key, and the Set method is the collection of the Add method and the Replace method
Mmecache::replace method: The Replace method replaces the cached content of a specified key and returns False if key does not exist
Comparison:
Method |
When key exists |
When key does not exist |
Add |
False |
True |
Replace |
Replace (true) |
False |
Set |
Replace (true) |
True |
I believe you know how to use these methods in the future, it is so simple
This column more highlights: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/tools/