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

Breadcrumb

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

function Cache::gcVcsCache

File

vendor/composer/composer/src/Composer/Cache.php, line 333

Class

Cache
Reads/writes to a filesystem cache

Namespace

Composer

Code

public function gcVcsCache(int $ttl) : bool {
    if ($this->isEnabled()) {
        $expire = new \DateTime();
        $expire->modify('-' . $ttl . ' seconds');
        $finder = Finder::create()->in($this->root)
            ->directories()
            ->depth(0)
            ->date('until ' . $expire->format('Y-m-d H:i:s'));
        foreach ($finder as $file) {
            $this->filesystem
                ->removeDirectory($file->getPathname());
        }
        self::$cacheCollected = true;
        return true;
    }
    return false;
}

API Navigation

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