Users should only access the lru_cache through its public API:
    cache_info, cache_clear
    The internals of the lru_cache are encapsulated for thread safety and
    to allow the implementation to change.
322603
def _weak_lru_cache(maxsize=100):
    
    def decorating_function(
            user_function, tuple=tuple, sorted=sorted, len=len,
            KeyError=KeyError):

        hits, misses = [0], [0]
        kwd_mark = (object(),)    # separates positional and keyword args
        lock = Lock()             # needed because OrderedDict isn't threadsafe

        if maxsize is None:
            cache = _WeakArgsDict()  # cache without ordering or size limit

            @wraps(user_function)
            def wrapper(*args, **kwds):
                key = args
                if kwds:
                    key += kwd_mark + tuple(sorted(kwds.items()))
                try:
                    result = cache[key]
                    hits[0] += 1
                    return result
                except KeyError:
                    pass
                result = user_function(*args, **kwds)
                cache[key] = result
                misses[0] += 1
                return result
        else:
            # ordered least recent to most recent
            cache = _WeakArgsOrderedDict()
            cache_popitem = cache.popitem
            cache_renew = cache.move_to_end

            @wraps(user_function)
            def wrapper(*args, **kwds):
                key = args
                if kwds:
                    key += kwd_mark + tuple(sorted(kwds.items()))
                with lock:
                    try:
                        result = cache[key]
                        cache_renew(key)    # record recent use of this key
                        hits[0] += 1
                        return result
                    except KeyError:
                        pass
                result = user_function(*args, **kwds)
                with lock:
                    cache[key] = result     # record recent use of this key
                    misses[0] += 1
                    if len(cache) > maxsize:
                        # purge least recently used cache entry
                        cache_popitem(False)
                return result

        def cache_info():
            """Report cache statistics"""
            with lock:
                return hits[0], misses[0], maxsize, len(cache)

        def cache_clear():
            """Clear the cache and cache statistics"""
            with lock:
                cache.clear()
                hits[0] = misses[0] = 0

        wrapper.cache_info = cache_info
        wrapper.cache_clear = cache_clear
        return wrapper

    return decorating_function
1093331
def _clear_cache(url, ts=None):
    '''
    
    '''
    if ts is None:
        # Clears an entire ForeignResource cache
        res = ForeignResource(url)
        if not os.path.exists(res.cache_path_base):
            cli.printerr('%s is not cached (looked at %s)'
                         % (url, res.cache_path_base))
            return
        cli.print('%s: clearing ALL at %s'
                  % (url, res.cache_path_base))
        res.cache_remove_all()
    else:
        # Clears an entire ForeignResource cache
        res = TypedResource(url, ts)
        if not res.cache_exists():
            cli.printerr('%s is not cached for type %s (looked at %s)'
                         % (url, str(ts), res.cache_path))
            return
        cli.print('%s: clearing "%s" at %s'
                  % (url, str(ts), res.cache_path))
        if os.path.isdir(res.cache_path):
            res.cache_remove_as_dir()
        else:
            res.cache_remove()
1173806
@Nonnull
  public EChange clearCache ()
  {
    return m_aRWLock.writeLocked ( () -> {
      EChange ret = m_aList.removeAll ();
      if (!m_aMapExt.isEmpty ())
      {
        m_aMapExt.clear ();
        ret = EChange.CHANGED;
      }
      if (!m_aMapMimeType.isEmpty ())
      {
        m_aMapMimeType.clear ();
        ret = EChange.CHANGED;
      }
      return ret;
    });
  }
177290
@Override
	public void clearCache(CPFriendlyURLEntry cpFriendlyURLEntry) {
		entityCache.removeResult(CPFriendlyURLEntryModelImpl.ENTITY_CACHE_ENABLED,
			CPFriendlyURLEntryImpl.class, cpFriendlyURLEntry.getPrimaryKey());

		finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
		finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);

		clearUniqueFindersCache((CPFriendlyURLEntryModelImpl)cpFriendlyURLEntry,
			true);
	}
95506
private void startInternalCache() {
      if (knownClassesCache == null) {
         synchronized (this) {
            if (knownClassesCache == null) {
               internalCacheRegistry.registerInternalCache(QUERY_KNOWN_CLASSES_CACHE_NAME, getInternalCacheConfig(), EnumSet.of(InternalCacheRegistry.Flag.PERSISTENT));
               Cache<KeyValuePair<String, Class<?>>, Boolean> knownClassesCache = SecurityActions.getCache(cacheManager, QUERY_KNOWN_CLASSES_CACHE_NAME);
               this.knownClassesCache = knownClassesCache.getAdvancedCache().withFlags(Flag.SKIP_LOCKING, Flag.IGNORE_RETURN_VALUES);
               transactionHelper = new TransactionHelper(this.knownClassesCache.getTransactionManager());
            }
         }
      }
   }
1238659
public void dropCaches() {
    if (use_lru) {
      lru_name_cache.invalidateAll();
      lru_id_cache.invalidateAll();
    } else {
      name_cache.clear();
      id_cache.clear();
    }
  }
1225068
def _looks_like_lru_cache(node):
    """"""
    if not node.decorators:
        return False
    for decorator in node.decorators.nodes:
        if not isinstance(decorator, astroid.Call):
            continue
        if _looks_like_functools_member(decorator, "lru_cache"):
            return True
    return False
1080435
def clear(self, key):
        # type: (Hashable) -> DataLoader
        
        cache_key = self.get_cache_key(key)
        self._promise_cache.pop(cache_key, None)
        return self
179886
def clearCache():
		
		if os.path.exists(CachedDataManager._cacheDir()) == True:
			shutil.rmtree(CachedDataManager._cacheDir())
1100382
def _removeLru(self):
        
        (dataFile, handle) = self._cache.pop()
        handle.close()
        return dataFile
1138655
def _raw_object_cache_getbuffer(self, data):
        
        if self._object_cache_getbuffer is None:
            return
        module_ptr = data.contents.module_ptr
        module = self._find_module_ptr(module_ptr)
        if module is None:
            # The LLVM EE should only give notifications for modules
            # known by us.
            raise RuntimeError("object compilation notification "
                               "for unknown module %s" % (module_ptr,))

        buf = self._object_cache_getbuffer(module)
        if buf is not None:
            # Create a copy, which will be freed by the caller
            data[0].buf_ptr = ffi.lib.LLVMPY_CreateByteString(buf, len(buf))
            data[0].buf_len = len(buf)
950895
def clear(self, key=None):
        
        if not self.options.enabled:
            return CACHE_DISABLED
        logger.debug('clear(key={})'.format(repr(key)))
        if key is not None and key in self._dict.keys():
            del self._dict[key]
            logger.info('cache cleared for key: ' + repr(key))
        elif not key:
            for cached_key in [k for k in self._dict.keys()]:
                del self._dict[cached_key]
            logger.info('cache cleared for ALL keys')
        return True
53184
def lru_cache(fn):
    '''
    
    '''
    @wraps(fn)
    def memoized_fn(*args):
        pargs = pickle.dumps(args)
        if pargs not in memoized_fn.cache:
            memoized_fn.cache[pargs] = fn(*args)
        return memoized_fn.cache[pargs]
    # propagate function attributes in the event that
    # this is applied as a function and not a decorator
    for attr, value in iter(fn.__dict__.items()):
        setattr(memoized_fn, attr, value)
    memoized_fn.cache = {}
    return memoized_fn
3227
def save_cache(dpath, fname, cfgstr, data, ext='.cPkl', verbose=None):
    
    fpath = _args2_fpath(dpath, fname, cfgstr, ext)
    util_io.save_data(fpath, data, verbose=verbose)
    return fpath
734780
function clearCache() {
  cache_stopById.clear();
  cache_stopByName.clear();
  cache_stopByStatusId.clear();
  cache_stops.clear();
  cache_stopsByRoute.clear();
}
1353053
def trace_memory_clean_caches(self):
        

        urllib.parse.clear_cache()
        re.purge()
        linecache.clearcache()
        copyreg.clear_extension_cache()

        if hasattr(fnmatch, "purge"):
            fnmatch.purge()  # pylint: disable=no-member
        elif hasattr(fnmatch, "_purge"):
            fnmatch._purge()  # pylint: disable=no-member

        if hasattr(encodings, "_cache") and len(encodings._cache) > 0:
            encodings._cache = {}

        for handler in context.log.handlers:
            handler.flush()
9239
private void cacheClass(ClassSource classSource, String outerClassName) {
        if (classCacheMode != UserCodeDeploymentConfig.ClassCacheMode.OFF) {
            classSourceMap.put(outerClassName, classSource);
        } else {
            ThreadLocalClassCache.store(outerClassName, classSource);
        }
    }