igormatkovic/memcache

此软件包的最新版本(1.7.2)没有提供许可信息。

Laravel 4 的 Memcache 模块

1.7.2 2014-10-09 20:01 UTC

This package is not auto-updated.

Last update: 2024-09-24 03:05:31 UTC


README

========

设置应用

将软件包添加到您的 composer.json 并运行 composer update。

"igormatkovic/memcache": "dev-master"

在 app/config/app.php 中添加 memcache 服务提供者

'Igormatkovic\Memcache\MemcacheServiceProvider',

现在您可以更新 app/config/session.php 配置文件以使用 memcache

	'driver' => 'memcache',

或者...

将以下内容添加到 app/start/global.php 中(仅缓存)

use Illuminate\Cache\Repository;
use Igormatkovic\Memcache\MemcacheStore;
use Igormatkovic\Memcache\MemcacheConnector;

Cache::extend('memcache', function($app) {
	$servers = Config::get('cache.memcached'); 
	$prefix = Config::get('cache.prefix'); 
				  
	$memcache = (new MemcacheConnector())->connect($servers);
			 
	return new Repository(new MemcacheStore($memcache, $prefix));
});

更新驱动程序 app/config/cache.php

	'driver' => 'memcache',

单元测试视图 phpunit

	phpunit

注意:此 memcache 驱动程序使用与 Memcached 相同的配置

此插件是由于 Webtatic 仓库缺少 Memcache 支持而构建的 :/