stevenlei/yii2-keyvalue

此包已被废弃,不再维护。未建议替代包。

KeyValue

安装: 16

依赖: 0

建议者: 0

安全性: 0

星标: 1

关注者: 1

分支: 1

开放问题: 0

类型:yii2-extension

v1.0.1 2018-03-08 04:15 UTC

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