Deletes all outdated (time to save expired) cache items in a single operation.

@return bool True on success and false on failure.
549575
public function deleteOutdated(): bool
    {
        $sql =  'DELETE FROM `' . $this->table . '`'
                . ' WHERE `' . $this->savetimeField . '`<'
                . '(' . time() . '-`' . $this->timestampField . '`)';
        return $this->db->query($sql);
    }
1181331
public function restore()
    {
        // Restore settings before last override and delete override from stash
        if ($this->overrides) {
            $old = array_pop($this->overrides);
            $this->apply($old, $purge = true);

            return true;
        }

        return false;
    }
196819
public function clearCache()
    {
        $result = $this->getContainer()->get('fileManager')->removeInDir($this->cachePath);

        if ($result != true) {
            throw new Exceptions\Error("Error while clearing cache");
        }

        $this->updateCacheTimestamp();

        return $result;
    }
303626
public function expireAll()
    {
        $this->Logger->debug('Expiring all items.');

        try {
            foreach ( new DirectoryIterator($this->dir) as $item ) {
                $filename = $item->getPath() .DIRECTORY_SEPARATOR.$item->getFilename();
                $pathinfo = pathinfo($filename);

                // Find all files ending with .cfcache and destroy them!
                if ($pathinfo['extension'] == $this->fileExtension)
                    unlink($item->getPath() .DIRECTORY_SEPARATOR.$item->getFilename());
            }
        } catch (Exception $e) {
            $this->Logger->error("expireAll error: " . $e->getMessage());
            return false;
        }

        return true;
    }
227556
function MustUseCache()
    {
        if ($this->cacheLifetime == 0)
        {
            return false;
        }
        if (!File::Exists($this->file))
        {
            return false;
        }
        $now = Date::Now();
        $lastMod = File::GetLastModified($this->file);
        if ($now->TimeStamp() - $lastMod->TimeStamp() < $this->cacheLifetime)
        {
            return true;
        }
        return false;
    }
239505
public function delete_all_cached_data() {
		global $wpdb;

		$table         = is_multisite() ? $wpdb->base_prefix . 'sitemeta' : $wpdb->base_prefix . 'options';
		$column        = is_multisite() ? 'meta_key' : 'option_name';
		$delete_string = 'DELETE FROM ' . $table . ' WHERE ' . $column . ' LIKE %s LIMIT 1000';

		$wpdb->query( $wpdb->prepare( $delete_string, [ '%ghu-%' ] ) );

		wp_cron();

		return true;
	}
63935
def cache_clean(self):
		
		now = time.time()
		keys_for_removal = collections.deque()
		for key, (_, expiration) in self.__cache.items():
			if expiration < now:
				keys_for_removal.append(key)
		for key in keys_for_removal:
			del self.__cache[key]
264074
public function erase(){
    	if($this->exists())
		{
			$query = new Query(static::table());
			$query->delete()->where($this->getIdentifyCondition());
			if($query->execute())
                $this->clear();
            return $query->success();
		}
        return false;
    }
167508
public final function clear()
   {
       foreach ($this->pool as $value) {
           if (!$this->poolDeleteItem($value)) {
               return false;
           }
       }
       return true;
   }
788448
public function clearExpiredPDO()
    {
        if ($this->Using !== 'PDO') {
            return false;
        }
        $PDO = $this->WorkingData->prepare(self::clearExpiredQuery);
        if ($PDO !== false && $PDO->execute(['time' => time()])) {
            return ($PDO->rowCount() > 0);
        }
        return false;
    }
765097
public function clear()
    {
        try {
            $this->_repository
                    ->createQueryBuilder('c')
                    ->delete()
                    ->where('1 = 1')
                    ->getQuery()
                    ->execute();
            $this->resetCacheEntity();
        } catch (\Exception $e) {
            $this->log('warning', sprintf('Enable to clear cache : %s', $e->getMessage()));

            return false;
        }

        return true;
    }
568879
public function isExpired()
    {
        $curTime = $this->timer['now'];
        $maxTime = $this->timer['last'] + $this->_lifetime;

        return ($maxTime < $curTime);
    }
547781
public function deleteExpired()
    {
        // General expirations. Maximum limiter is 1m.
        $oldest = new \DateTime('-1 month -1 day');
        $q      = $this->getEntityManager()->getConnection()->createQueryBuilder();
        $q->delete(MAUTIC_TABLE_PREFIX.$this->getTableName());
        $q->where(
            $q->expr()->lt('date_added', 'FROM_UNIXTIME(:oldest)')
        );
        $q->setParameter('oldest', (int) $oldest->getTimestamp());
        $q->execute();
    }
1350897
public function eraseExpired() {
    $cacheData = $this->_loadCache();
    if (true === is_array($cacheData)) {
      $counter = 0;
      foreach ($cacheData as $key => $entry) {
        if (true === $this->_checkExpired($entry['time'], $entry['expire'])) {
          unset($cacheData[$key]);
          $counter++;
        }
      }
      if ($counter > 0) {
        $cacheData = json_encode($cacheData);
        file_put_contents($this->getCacheDir(), $cacheData);
      }
      return $counter;
    }
  }
127200
private function isCacheExpired()
    {
        if (empty($this->cacheInterval)) {
            return true;
        }

        $cache_file = $this->cacheDirectory.'/translations/cache_timestamp';
        $cache_dir  =$this->cacheDirectory.'/translations';
        if ('\\' === DIRECTORY_SEPARATOR) {
            $cache_file = strtr($cache_file, '/', '\\');
            $cache_dir = strtr($cache_dir, '/', '\\');
        }
        if (!\is_dir($cache_dir)) {
            \mkdir($cache_dir);
        }        
        if (!\file_exists($cache_file)) {
            \touch($cache_file);
            return true;
        }
        $expired = false;
        if ((\time() - \filemtime($cache_file)) > $this->cacheInterval) {
            \file_put_contents($cache_file, \time());
            $expired = true;
        }

        return $expired;
    }
368432
public function deleteAll()
	{
	    if (!$this->namespace) {
	        return $this->clear();
        }

		$namespaceCacheKey = $this->getNamespaceCacheKey();
		$namespaceVersion = $this->getNamespaceVersion() + 1;

		if ($this->doSet($namespaceCacheKey, [true, $namespaceVersion, [], 0])) {
			$this->namespaceVersion = $namespaceVersion;

			return true;
		}

		return false;
	}
705137
public function purge() {
        if ($this->isready) {
            // Only use delete multi if we have the correct extension installed and if the memcached
            // server is shared (flushing the cache is quicker otherwise).
            $candeletemulti = ($this->candeletemulti && $this->isshared);

            if ($this->clustered) {
                foreach ($this->setconnections as $connection) {
                    if ($candeletemulti) {
                        $keys = self::get_prefixed_keys($connection, $this->prefix);
                        $connection->deleteMulti($keys);
                    } else {
                        // Oh damn, this isn't multi-site safe.
                        $connection->flush();
                    }
                }
            } else if ($candeletemulti) {
                $keys = self::get_prefixed_keys($this->connection, $this->prefix);
                $this->connection->deleteMulti($keys);
            } else {
                // Oh damn, this isn't multi-site safe.
                $this->connection->flush();
            }
        }
        // It never fails. Ever.
        return true;
    }