How to operate memcache cache in php? Please provide the specific code? Ask God for answers
Duplicate:
https://segmentfault.com/q/10...
How to operate memcache cache in php? Please provide the specific code? Ask God for answers
Duplicate:
https://segmentfault.com/q/10...
Those who hold out their hands are the most annoying! ! ! Wouldn’t you use Baidu and Google first? ? ?
PHP official manual memcahce
PHP official manual memcached
The specific code still depends on personal habits! As long as you enable the memcache
extension. You can also re-encapsulate a memcache
class call that suits you, or you can just use the built-in function without encapsulation. Examples of directly calling built-in functions are as follows
<code>//连接 $cache = new Memcache; $cache->connect("cache.example.net", 12000); //保存数据 $cache->set('keySave', 'This is first value', 0, 60); $val = $cache->get('keySave'); echo "Get keySave value: " . $val ."<br />"; //删除数据 $cache->delete('keySave'); $val = $cache->get('keySave'); echo "Get keySave value: " . $val . "<br />"; //关闭连接 $cache->close();</code>
For reference only, hope it helps you