Created
February 28, 2022 13:41
-
-
Save LoveDuckie/b2a28fac0bea24dd3f21dacd9951f0d9 to your computer and use it in GitHub Desktop.
A configuration snippet for integrating memcached caching support with SliverStripe.
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
<?php | |
use SilverStripe\Core\Injector\Injector; | |
use SilverStripe\Core\Cache\MemcachedCacheFactory; | |
$cacheClient = new Memcached(); | |
$cacheClient->addServer('your-memcached-server-hostname-goes-here', 11211); | |
$cacheFactory = new MemcachedCacheFactory($cacheClient); | |
Injector::inst()->registerService($cacheFactory, "SilverStripe\\Core\\Cache\\CacheFactory"); | |
Injector::inst()->registerService($cacheFactory, "CacheFactory"); | |
Injector::nest(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment