yii2 memcached 的使用
1:开启环境内中的memcache扩展
2:在config中的mian.php加
<?php
return [
"vendorPath" => dirname(dirname(__DIR__)) . "/vendor",
"components" => [
"cache" => [
"class" => "yiicachingMemCache",
"servers" => [
[
"host" => "127.0.0.1",
"port" => 11211,
"weight" => 100,
],
],
],
],
];
3.在框架中的使用
//存储缓存
Yii::$app->cache->set("名","值","过期时间");
//获取缓存
Yii::$app->cache->get("名");
//删除缓存
Yii::$app->cache->delete("名");
等等......
声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
- 上一篇:没有了
- 下一篇:没有了