igormatkovic / Laravel-4-Memcache by igormatkovic

Memcache module for Laravel 4
8,228
4
2
Package Data
Maintainer Username: igormatkovic
Maintainer Contact: igor@cod3.me (Igor Matkovic)
Package Create Date: 2014-07-02
Package Last Update: 2015-01-26
Language: PHP
License: Unknown
Last Refreshed: 2024-09-01 03:14:33
Package Statistics
Total Downloads: 8,228
Monthly Downloads: 1
Daily Downloads: 0
Total Stars: 4
Total Watchers: 2
Total Forks: 5
Total Open Issues: 1

Laravel 4 Memcache support

========

SetUp Application

Add the package to your composer.json and run composer update.

"igormatkovic/memcache": "dev-master"

Add the memcache service provider in app/config/app.php:

'Igormatkovic\Memcache\MemcacheServiceProvider',

You may now update your app/config/session.php config file to use memcache

	'driver' => 'memcache',

OR...

Add this to your app/start/global.php (Cache only)

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));
});

Update your driver app/config/cache.php

	'driver' => 'memcache',

Unit test view phpunit

	phpunit

Notice: This memcache driver uses the same config as Memcached

This addon was build because of the Webtatic repo lacking Memcache Support :/