urbanindo/yii2-elasticmemcache

不使用节点发现插件的 Yii2 elastic memcache 组件

1.0.1 2015-08-19 06:56 UTC

This package is auto-updated.

Last update: 2024-09-22 15:52:52 UTC


README

不使用节点发现插件的 Yii2 AWS Elasticache Memcache 组件

Latest Stable Version Total Downloads Latest Unstable Version Build Status

安装

安装此扩展的首选方式是通过 composer

运行以下命令之一:

php composer.phar require --prefer-dist urbanindo/yii2-elasticmemcache "*"

或者将以下内容添加到你的 composer.json 文件的 require 部分。

"urbanindo/yii2-elasticmemcache": "*"

使用方法

'components' => [
    'cache' => [
	    'class' => UrbanIndo\Yii2\ElasticMemcache\Cache::class,
	    'serverConfigs' => [
	        [
	                'host' => 'CacheClusterConfiguration1.cache.amazonaws.com', // modify this
	                'port' => 11211,
	                'weight' => 60,
	        ],
	        [
	                'host' => 'CacheClusterConfiguration2.cache.amazonaws.com', // modify this
	                'port' => 11211,
	                'weight' => 40,
	        ]
	    ],
	    'cache' => [
	    	'class' => yii\caching\FileCache::class
	    ]
    ]
]

运行测试

  • 将 test/template-local.php 复制到 local.php
  • 修改它以匹配你的 aws elasticache 配置
  • 运行 vendor/bin/phpunit --bootstrap test/bootstrap.php test/CacheTest