laravel/framework — pull request #6586 by stevenmaguire (2014-12-05 17:17:02+00:00)
Title: [Proposal] Allow public access to repository creation on cache manager

Currently the repository creation within the CacheManager is protected. When adding new cache drivers the implementation requires creation of specific class. It appears to me that the CacheManager is responsible for controlling Repository implementation.

```php
Cache::extend('elasticache', function() {
$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')));
});
```

I propose that this Repository creation process be publicly accessible for extension, such that the above use case looks more like:

```php
Cache::extend('elasticache', function() {
$servers = Config::get('cache.memcached');
$elasticache = new Illuminate\Cache\ElasticacheConnector();
$memcached = $elasticache->connect($servers);
return Cache::getRepository(new Illuminate\Cache\MemcachedStore($memcached, Config::get('cache.prefix')));
});
```

The proposed solution in this pull request adds a new public `getRepository` method to the CacheManager class that calls the protected `repository` method.