function LruMemoryCache::moveItemsToLeastRecentlyUsed

Moves items to the least recently used positions.

Parameters

array $items: An array of items to move to the least recently used positions.

2 calls to LruMemoryCache::moveItemsToLeastRecentlyUsed()
LruMemoryCache::invalidateMultiple in core/lib/Drupal/Core/Cache/MemoryCache/LruMemoryCache.php
Marks cache items as invalid.
LruMemoryCache::invalidateTags in core/lib/Drupal/Core/Cache/MemoryCache/LruMemoryCache.php
Marks cache items with any of the specified tags as invalid.

File

core/lib/Drupal/Core/Cache/MemoryCache/LruMemoryCache.php, line 132

Class

LruMemoryCache
Defines a least recently used (LRU) static cache implementation.

Namespace

Drupal\Core\Cache\MemoryCache

Code

private function moveItemsToLeastRecentlyUsed(array $items) : void {
    // This cannot use array_unshift() because it would reindex an array with
    // numeric cache IDs.
    if (!empty($items)) {
        $this->cache = $items + $this->cache;
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.