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

Breadcrumb

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

function FileCache::set

Overrides FileCacheInterface::set

File

core/lib/Drupal/Component/FileCache/FileCache.php, line 123

Class

FileCache
Allows to cache data based on file modification dates.

Namespace

Drupal\Component\FileCache

Code

public function set($filepath, $data) {
    $realpath = realpath($filepath);
    $cached = [
        'mtime' => filemtime($filepath),
        'filepath' => $filepath,
        'data' => $data,
    ];
    $cid = $this->prefix . ':' . $this->collection . ':' . $realpath;
    static::$cached[$cid] = $cached;
    if ($this->cache) {
        $this->cache
            ->store($cid, $cached);
    }
}

API Navigation

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