Utility method to purge caches related to given glossary.
@param \stdClass $glossary
499765
public static function reset_glossary($glossary) {
        if (!$glossary->usedynalink) {
            return;
        }
        self::reset_course_muc($glossary->course);
        if ($glossary->globalglossary) {
            self::reset_global_muc();
        }
    }
550337
public static function purge(string $dir): void
	{
		if (!is_dir($dir)) {
			mkdir($dir);
		}

		/** @var SplFileInfo $entry */
		foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST) as $entry) {
			if ($entry->isDir()) {
				rmdir((string) $entry->getRealPath());
			} else {
				unlink((string) $entry->getRealPath());
			}
		}
	}
1354551
private function cleanTarget(): void
    {
        foreach ($this->targetDictionary->keys() as $key) {
            if (!$this->sourceDictionary->has($key) || $this->sourceDictionary->get($key)->isSourceEmpty()) {
                $this->logger->log($this->logLevel, 'Removing obsolete {key}.', ['key' => $key]);
                if ($this->dryRun) {
                    continue;
                }

                $this->targetDictionary->remove($key);
            }
        }
    }
224490
public function clear($class)
    {
        $concrete = $this->getAlias($class);
        unset($this->_aliases[$class]);

        unset($this->_definitions[$concrete], $this->_singletons[$concrete]);
    }
1031227
public static function hook_course_deleted(stdClass $course) {
        global $DB;
        $DB->delete_records(course_competency::TABLE, array('courseid' => $course->id));
        $DB->delete_records(course_competency_settings::TABLE, array('courseid' => $course->id));
        $DB->delete_records(user_competency_course::TABLE, array('courseid' => $course->id));
    }
271132
public function clearCache()
  {
    $files = glob($this->cachePath);
    foreach($files as $file) {
      if (is_file($file)) {
        unlink($file);
      }
    }
  }
398121
public function purgeAll() {
		
		if ($this->useFallback) {
			if ($this->log) {
				$this->log->trace("Purging the whole file cache.");
			}
			$files = glob($this->getDirectory()."*");
			foreach ($files as $filename) {
				unlink($filename);
			}
			return;
		}
		
		apc_clear_cache('user');
	}
1254707
protected static function reset_caches() {
        self::$cache_contextsbyid = array();
        self::$cache_contexts     = array();
        self::$cache_count        = 0;
        self::$cache_preloaded    = array();

        self::$systemcontext = null;
    }
1166543
public function purge($key) {
		
		if ($this->useFallback) {
			if ($this->log) {
				$this->log->trace("Purging key '$key' from file cache.");
			}
			$filename = $this->getFileName($key);
			unlink($filename);
			return;
		}
	
		if ($this->log) {
			$this->log->trace("Purging key '$key' from APC cache.");
		}
	
		apc_delete($key);
	}
324627
public function purgeAll() {
		if ($this->log) {
			if ($this->log instanceof LoggerInterface) {
				$this->log->info("Purging the whole file cache.");
			} else {
				$this->log->trace("Purging the whole file cache.");
			}
		}
        self::rrmdir($this->getDirectory());
	}
714484
public function clearCache()
    {
        $cachePath = $this->cachePath();

        if (!file_exists($cachePath)) {
            return;
        }

        $dir = new RecursiveDirectoryIterator($cachePath, RecursiveDirectoryIterator::SKIP_DOTS);
        $files = new RecursiveIteratorIterator($dir, RecursiveIteratorIterator::CHILD_FIRST);

        foreach($files as $file) {
            $path = $file->getRealPath();
            $file->isDir() ? rmdir($path) : unlink($path);
        }
        rmdir($cachePath);
    }
948627
protected function clear_cached_data($qubaids) {
        global $DB;
        $DB->delete_records('quiz_statistics', array('hashcode' => $qubaids->get_hash_code()));
        $DB->delete_records('question_statistics', array('hashcode' => $qubaids->get_hash_code()));
        $DB->delete_records('question_response_analysis', array('hashcode' => $qubaids->get_hash_code()));
    }
61045
public function clear(): void
    {
        $list = $this->dataRepository->getList()
                ->filterBy('key', $this->keyPrefix, 'startWith');
        foreach ($list as $item) {
            $this->dataRepository->delete($item->key);
        };
    }
197564
public function forget($collection)
    {
        $collection = $this->getCollectionNameFromInstance($collection);

        if ($this->has($collection))
        {
            $this->dirty = true;

            unset($this->entries[$collection]);
        }
    }
1010019
def clear_caches():  # suppress(unused-function)
    """"""
    for _, reader in _spellchecker_cache.values():
        reader.close()

    _spellchecker_cache.clear()
    _valid_words_cache.clear()
    _user_dictionary_cache.clear()
413127
public function purge() {
        if ($this->isready) {
            $this->collection->drop();
            $this->collection = $this->database->selectCollection($this->definitionhash);
        }

        return true;
    }
323662
public function clear(?string $namespace = self::DEFAULT_NAMESPACE): void
    {
        if (null === $namespace) {
            $this->nodeRefs = [];
            return;
        }

        unset($this->nodeRefs[$namespace]);
    }