Created
September 11, 2013 20:00
-
-
Save sperelson/6528976 to your computer and use it in GitHub Desktop.
A Laravel 4.x snippet that will extend the cache driver with a new one that supports AWS ElastiCache. Blogged at http://blog.hapnic.com/2013/09/11/Laravel-4-and-ElastiCache/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Register the special elasticache handler here | |
Cache::extend('elasticache', function() { | |
require_once(__DIR__.'/../libraries/ElasticacheConnector.php'); | |
$servers = Config::get('cache.memcached'); | |
$elasticache = new Illuminate\Cache\ElasticacheConnector(); | |
$memcached = $elasticache->connect($servers); | |
return new Illuminate\Cache\Repository(new Illuminate\Cache\MemcachedStore($memcached, Config::get('cache.prefix'))); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment