Unverified Commit a39c03a9 authored by damiankloip's avatar damiankloip Committed by damiankloip
Browse files

Issue #2995907 by damiankloip, Fabianx: Remove Persistent Lock Implementation

parent 6086e151
......@@ -161,11 +161,6 @@ services:
class: Drupal\Core\Lock\LockBackendInterface
factory: memcache.lock.factory:get
# Replaces the default persistent lock backend with a memcache implementation.
lock.persistent:
class: Drupal\Core\Lock\LockBackendInterface
factory: memcache.lock.factory:getPersistent
## Cache Container on bootstrap ##
By default Drupal starts the cache_container on the database, in order to override that you can use the following code on your settings.php file. Make sure that the $class_load->addPsr4 is poiting to the right location of memcache (on this case modules/contrib/memcache/src)
......
......@@ -46,13 +46,4 @@ class MemcacheLockFactory {
return new MemcacheLockBackend($this->bin, $this->factory->get($this->bin));
}
/**
* Gets a persistent lock backend instance.
*
* @return \Drupal\Core\Lock\LockBackendInterface
*/
public function getPersistent() {
return new PersistentMemcacheLockBackend($this->bin, $this->factory->get($this->bin));
}
}
<?php
/**
* @file
* Contains \Drupal\memcache\PersistentMemcacheLockBackend.
*/
namespace Drupal\memcache\Lock;
use Drupal\memcache\DrupalMemcacheInterface;
class PersistentMemcacheLockBackend extends MemcacheLockBackend {
/**
* Constructs a new MemcacheLockBackend.
*
* @param \Drupal\Memcache\DrupalMemcacheInterface $memcache
*/
public function __construct($bin, DrupalMemcacheInterface $memcache) {
$this->bin = $bin;
// Do not call the parent constructor to avoid registering a shutdwon
// function that will release all locks at the end of the request.
$this->memcache = $memcache;
// Set the lockId to a fixed string to make the lock ID the same across
// multiple requests. The lock ID is used as a page token to relate all the
// locks set during a request to each other.
// @see \Drupal\Core\Lock\LockBackendInterface::getLockId()
$this->lockId = 'persistent';
}
}
......@@ -20,11 +20,6 @@ class MemcacheTestServiceProvider implements ServiceModifierInterface {
$definition->setFactory([new Reference('memcache.lock.factory'), 'get']);
$container->setDefinition('lock', $definition);
$definition = new Definition('Drupal\Core\Lock\LockBackendInterface');
$definition->setFactory([new Reference('memcache.lock.factory'), 'getPersistent']);
$container->setDefinition('lock.persistent', $definition);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment