ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
memcache 形式的缓存 **php 扩展需求** ~~~ 需要开启 php_memcache 扩展 ~~~ memcache 相关知识:[http://www.hcoder.net/books/read\_10090.html](http://www.hcoder.net/books/read_10090.html) **修改全局配置 phpGrace/config.php** ~~~ 'cache' => array(     'type'          => 'memcache',     //以下配置为memcache及redis类型缓存的必须设置     'host'          => '127.0.0.1', //主机地址     'port'          => '11211',     //端口     'pre'           => 'grace_'     //缓存变量前缀 ) ~~~ [](http://www.hcoder.net/books/read_10105.html) **调用演示** ~~~ <?php class indexController extends grace{     public function index(){         $this->cache('test', 12, '__getData');         p($this->test);     }          public function __getData(){         echo '无缓存,进行查询...<br />';         $db = db('persons');         $persons = $db->fetchAll();         return $persons;     }          public function t(){         $this->removeCache('test', '12');     } } ~~~