Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. BackendChain.php

function BackendChain::get

Overrides CacheBackendInterface::get

File

core/lib/Drupal/Core/Cache/BackendChain.php, line 65

Class

BackendChain
Defines a chained cache implementation for combining multiple cache backends.

Namespace

Drupal\Core\Cache

Code

public function get($cid, $allow_invalid = FALSE) {
    foreach ($this->backends as $index => $backend) {
        if (($return = $backend->get($cid, $allow_invalid)) !== FALSE) {
            // We found a result, propagate it to all missed backends.
            if ($index > 0) {
                for ($i = $index - 1; 0 <= $i; --$i) {
                    $this->backends[$i]
                        ->set($cid, $return->data, $return->expire, $return->tags);
                }
            }
            return $return;
        }
    }
    return FALSE;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal