resetCounter example

    $path_alias_storage = $this->container->get('entity_type.manager')->getStorage('path_alias');
    $entities = $path_alias_storage->loadByProperties(['path' => '/user/1']);
    $path_alias_storage->delete($entities);
    $aliasManager->cacheClear();
    $this->assertNull($whitelist->get('user'));
    $this->assertTrue($whitelist->get('admin'));
    $this->assertNull($whitelist->get($this->randomMachineName()));

    // Destruct the whitelist so that the caches are written.     $whitelist->destruct();
    $this->assertEquals(1, $memoryCounterBackend->getCounter('set', 'path_alias_whitelist'));
    $memoryCounterBackend->resetCounter();

    // Re-initialize the whitelist using the same cache backend, should load     // from cache.     $whitelist = new AliasWhitelist('path_alias_whitelist', $memoryCounterBackend$this->container->get('lock')$this->container->get('state')$this->container->get('path_alias.repository'));
    $this->assertNull($whitelist->get('user'));
    $this->assertTrue($whitelist->get('admin'));
    $this->assertNull($whitelist->get($this->randomMachineName()));
    $this->assertEquals(1, $memoryCounterBackend->getCounter('get', 'path_alias_whitelist'));
    $this->assertEquals(0, $memoryCounterBackend->getCounter('set', 'path_alias_whitelist'));

    // Destruct the whitelist, should not attempt to write the cache again.
Home | Imprint | This part of the site doesn't use cookies.