Created
May 13, 2014 20:41
-
-
Save justinph/99364c6c80d69cfff616 to your computer and use it in GitHub Desktop.
How to use laravel's Illuminate\Cache with Slim Framework
This file contains 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
$cacheConfig = array( | |
'config' => array( | |
'cache.driver' => 'memcached', | |
'cache.connection' => null, | |
'cache.memcached' => array( | |
array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100), | |
), | |
'cache.prefix' => 'laravel', | |
), | |
'memcached.connector' => new \Illuminate\Cache\MemcachedConnector(), | |
); | |
$cacheManager = new \Illuminate\Cache\CacheManager($cacheConfig); | |
$laraCache = $cacheManager->driver(); | |
//add to slim as $laraCache | |
$app->container->singleton('laraCache', function () use ($laraCache) { | |
// return $laraCache; | |
return $laraCache; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment