Skip to content

Instantly share code, notes, and snippets.

@justinph
Created May 13, 2014 20:41
Show Gist options
  • Save justinph/99364c6c80d69cfff616 to your computer and use it in GitHub Desktop.
Save justinph/99364c6c80d69cfff616 to your computer and use it in GitHub Desktop.
How to use laravel's Illuminate\Cache with Slim Framework
$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