cache-service-provider
cache-service-provider copied to clipboard
Move factories to be plain protected closures which return a cache
Currently the cache.factory and the cache.namespace services are protected closures, which return closures, which then return a cache instance. Change these services to be just protected closures, which return a cache instance to reduce complexity and bring it in line with conventions.
Before:
$app['caches'] = $app->extend('caches', function ($caches) use ($app) {
$caches['foo'] = $app['cache.namespace']('foobar');
return $caches;
});
After:
$app['caches'] = $app->extend('caches', function ($caches) use ($app) {
$caches['foo'] = function () use ($app) {
return $app['cache.namespace']('foobar');
};
return $caches;
});