Created
May 13, 2016 11:11
-
-
Save teameh/b1c39c27f55264f2bf5fd4ca05b23ad8 to your computer and use it in GitHub Desktop.
description
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
## Custom name registering / multiple services | |
You can register the service using a name other than the default name `memcache`. | |
```php | |
$app->register(new MemcachedServiceProvider('my.custom.name')); | |
``` | |
The same method can be used to register multiple services on your application. | |
If you do, make sure to also use different cache prefixes for each service. | |
```php | |
$app->register(new MemcachedServiceProvider('cache1'), array('memcached.prefix' => 'cache1')); | |
$app->register(new MemcachedServiceProvider('cache2'), array('memcached.prefix' => 'cache2')); | |
// usage | |
$app['cache1']->set('foo', 'bar'); | |
$app['cache2']->set('foo', 'baz'); | |
$app['cache1']->get('foo'); | |
$app['cache2']->get('foo'); | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment