Skip to content

Instantly share code, notes, and snippets.

@slivorezka
Last active December 7, 2018 14:16
Show Gist options
  • Save slivorezka/4b9f774d5e207fba9264d92d241e4d74 to your computer and use it in GitHub Desktop.
Save slivorezka/4b9f774d5e207fba9264d92d241e4d74 to your computer and use it in GitHub Desktop.
Memcache
if (class_exists('Memcached', FALSE)) {
$class_loader->addPsr4('Drupal\\memcache\\', 'modules/contrib/memcache/src');
$settings['bootstrap_container_definition'] = [
'parameters' => [],
'services' => [
'settings' => [
'class' => 'Drupal\Core\Site\Settings',
'factory' => 'Drupal\Core\Site\Settings::getInstance',
],
'memcache.settings' => [
'class' => 'Drupal\memcache\MemcacheSettings',
'arguments' => ['@settings'],
],
'memcache.factory' => [
'class' => 'Drupal\memcache\Driver\MemcacheDriverFactory',
'arguments' => ['@memcache.settings'],
],
'memcache.timestamp.invalidator.bin' => [
'class' => 'Drupal\memcache\Invalidator\MemcacheTimestampInvalidator',
'arguments' => ['@memcache.factory', 'memcache_bin_timestamps', 0.001],
],
'memcache.timestamp.invalidator.tag' => [
'class' => 'Drupal\memcache\Invalidator\MemcacheTimestampInvalidator',
'arguments' => ['@memcache.factory', 'memcache_tag_timestamps', 0.001],
],
'memcache.backend.cache.container' => [
'class' => 'Drupal\memcache\DrupalMemcacheInterface',
'factory' => ['@memcache.factory', 'get'],
'arguments' => ['container'],
],
'cache_tags_provider.container' => [
'class' => 'Drupal\memcache\Cache\TimestampCacheTagsChecksum',
'arguments' => ['@memcache.timestamp.invalidator.tag'],
],
'cache.container' => [
'class' => 'Drupal\memcache\MemcacheBackend',
'arguments' => ['container', '@memcache.backend.cache.container', '@cache_tags_provider.container', '@memcache.timestamp.invalidator.bin'],
],
],
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment