The README currently has this:

## LOCKS ##

Memcache locks can be enabled through the services.yml file.

  services:
    # Replaces the default lock backend with a memcache implementation.
    lock:
      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

...but it looks like if you copy and paste that into services.yml without removing the extra level of indentation, it silently does nothing.

Remove the extra pair of spaces before each line, and the memcache lock backend gets picked up by Drupal (you need to rebuild cache to make sure the container is rebuilt).

Patch on the way to remove the extra whitespace.

CommentFileSizeAuthor
#2 remove_whitespace-2909178-2.patch1.03 KBmcdruid
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mcdruid created an issue. See original summary.

mcdruid’s picture

Status: Active » Needs review
FileSize
1.03 KB
anavarre’s picture

Status: Needs review » Reviewed & tested by the community
mcdruid’s picture

If anyone wants to test this, if you only put the memcache lock lines (with the extra whitespace) into services.yml you'll get an error:

exception 'Symfony\Component\Yaml\Exception\ParseException' with message 'Unable to parse at line 3 (near "  services:").' in /path/to/drupal-8.x/vendor/symfony/yaml/Parser.php:319

...but if there's something before the memcache lines e.g.

parameters:
  # perhaps some more stuff here

  services:
    # Replaces the default lock backend with a memcache implementation.
    lock:
      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

...there's no error, but neither will the memcache lock backend be registered / used.

adammalone’s picture

Agreed, this should be committed (albeit with changes already committed in #2852460: Document Locking Backend). Alternatively, the README could suggest adding a separate file for inclusion in settings.php e.g.

settings.php

$settings['container_yamls'][] = $app_root . '/' . $site_path . '/memcache.services.yml';

sites/default/memcache.services.yml

services:
  lock:
    class: Drupal\Core\Lock\LockBackendInterface
    factory: ['@memcache.lock.factory', get]
  lock.persistent:
    class: Drupal\Core\Lock\LockBackendInterface
    factory: ['@memcache.lock.factory', getPersistent]
catch’s picture

Status: Reviewed & tested by the community » Fixed

Patch didn't quite apply but given this was just an indentation change, did it locally. Committed/pushed to 8.x-2.x, thanks!

  • catch committed a86ef52 on 8.x-2.x authored by mcdruid
    Issue #2909178 by mcdruid: remove extra indentation from lock services....

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.