stevenlei / yii2-keyvalue
此包已被废弃,不再维护。未建议替代包。
KeyValue
v1.0.1
2018-03-08 04:15 UTC
Requires
- yiisoft/yii2: ~2.0.0
This package is auto-updated.
Last update: 2023-04-29 01:01:20 UTC
README
KeyValue
安装
安装此扩展的首选方式是通过composer。
运行以下命令之一:
php composer.phar require --prefer-dist stevenlei/yii2-keyvalue "^1.0.0"
或
"stevenlei/yii2-keyvalue": "^1.0.0"
将以下内容添加到您的composer.json文件的require部分。
用法
配置
添加cache配置
使用FileCache
return [
'components' => [
'cache' => [
'class' => 'yii\caching\FileCache',
],
]
]
或Memcache
return [
'components' => [
'class' => 'yii\caching\MemCache',
'keyPrefix' => '',
'useMemcached' => true,
'servers' => [
[
'host' => '127.0.0.1',
'port' => 11211,
//'weight' => 60
],
],
]
]
或Redis
return [
'components' => [
'class' => 'yii\redis\Cache',
'redis' => [
'hostname' => '127.0.0.1',
'port' => 6379,
'database' => 0,
]
]
]
]
添加模块配置
return [
'modules' => [
'kv' => [
'class' => 'stevenlei\keyvalue\Module',
],
],
];
migrations
yii migrate --migrationPath=@stevenlei/keyvalue/migrations
然后您可以通过以下URL访问KeyValue管理器:
https:///kv/key-value/index