Loop over free variables and delete cache for the whole tree after finished each one
177323
def dr_wrt(self, wrt, profiler=None):
        '''
        
        '''
        if wrt is self.x:
            jacs = []
            for fvi, freevar in enumerate(self.free_variables):
                tm = timer()
                if isinstance(freevar, ch.Select):
                    new_jac = self.obj.dr_wrt(freevar.a, profiler=profiler)
                    try:
                        new_jac = new_jac[:, freevar.idxs]
                    except:
                        # non-csc sparse matrices may not support column-wise indexing
                        new_jac = new_jac.tocsc()[:, freevar.idxs]
                else:
                    new_jac = self.obj.dr_wrt(freevar, profiler=profiler)

                pif('dx wrt {} in {}sec, sparse: {}'.format(freevar.short_name, tm(), sp.issparse(new_jac)))

                if self._make_dense and sp.issparse(new_jac):
                    new_jac = new_jac.todense()
                if self._make_sparse and not sp.issparse(new_jac):
                    new_jac = sp.csc_matrix(new_jac)

                if new_jac is None:
                    raise Exception(
                        'Objective has no derivative wrt free variable {}. '
                        'You should likely remove it.'.format(fvi))

                jacs.append(new_jac)
            tm = timer()
            utils.dfs_do_func_on_graph(self.obj, clear_cache_single)
            pif('dfs_do_func_on_graph in {}sec'.format(tm()))
            tm = timer()
            J = hstack(jacs)
            pif('hstack in {}sec'.format(tm()))
            return J
1275032
def clear(self):
        """"""
        if self._cache is None:
            return _NO_RESULTS
        if self._cache is not None:
            with self._cache as k:
                res = [x.as_operation() for x in k.values()]
                k.clear()
                k.out_deque.clear()
                return res
952053
function cleanSuperGlobalVariables()
    {
        if (isset($_GET)) $_GET = array();
        if (isset($_POST)) $_POST = array();
        if (isset($_COOKIE)) $_COOKIE = array();
        if (isset($_FILES)) $_FILES = array();
        if (isset($_ENV)) $_ENV = array();
        if (isset($_REQUEST)) $_REQUEST = array();
        if (isset($_SERVER)) $_SERVER = array();
        if (isset($_SESSION)) $_SESSION = array();
        if (isset($GLOBALS)) $GLOBALS = array();
    }
434374
def cleanup(self):
        
        empty_keys = [k for k, v in self.items() if not v]

        for k in empty_keys:
            del self[k]
106655
function destroyLocalVariablesList()
    {
        array_pop( $this->LocalVariablesNamesStack );

        if ( $this->LocalVariablesNamesStack )
            $this->CurrentLocalVariablesNames =& $this->LocalVariablesNamesStack[ count( $this->LocalVariablesNamesStack ) - 1];
        else
            unset( $this->CurrentLocalVariablesNames );
    }
143726
function readFullTree() {
                        // Return null if the contextTree is not correctly closed
                        if (root !== currentContext) {
                            return null;
                        }

                        function recusiveRead(node) {
                            if (node.children.length === 0) {
                                delete node.children;
                            } else {
                                for (var i=0, max=node.children.length ; i<max ; i++) {
                                    recusiveRead(node.children[i]);
                                }
                            }
                            delete node.parent;
                        }
                        recusiveRead(root);

                        return root;
                    }
1224247
def clear(self):
        
        vname = self.varname
        if self.path.exists():
            logger.debug('deleting cached work: {}'.format(self.path))
            self.path.unlink()
        if self.owner is not None and hasattr(self.owner, vname):
            logger.debug('removing instance var: {}'.format(vname))
            delattr(self.owner, vname)
        self.clear_global()
668113
static function clear() {
    if ( empty(self::$_cache) || DEBUGKEEPTEMP ) return;
    
    foreach ( self::$_cache as $file ) {
      if (DEBUGPNG) print "[clear unlink $file]";
      unlink($file);
    }
  }
949935
def clear(self):
        
        # The del_binfo() call here isn't necessary for normal execution,
        # but is for interactive mode, where we might rebuild the same
        # target and need to start from scratch.
        self.del_binfo()
        self.clear_memoized_values()
        self.ninfo = self.new_ninfo()
        self.executor_cleanup()
        try:
            delattr(self, '_calculated_sig')
        except AttributeError:
            pass
        self.includes = None
1275455
function clear() {
  timeouts.forEach((callback, timeout) => {
    clearTimeout(timeout);

    // reject Promise or execute callback which returns Error
    callback();
  });

  const length = size();
  cache.clear();
  return length;
}
705351
def clear_cache(self):
        """"""
        for cmd in (self.cat_file_all, self.cat_file_header):
            if cmd:
                cmd.__del__()

        self.cat_file_all = None
        self.cat_file_header = None
        return self
56291
static function clearViewCacheForSubtree( eZContentObjectTreeNode $node, $clearForRootNode = true )
    {
        // Max nodes to fetch at a time
        static $limit = 200;

        if ( $clearForRootNode )
        {
            $objectID = $node->attribute( 'contentobject_id' );
            eZContentCacheManager::clearContentCacheIfNeeded( $objectID );
        }

        $offset = 0;
        $params = array( 'AsObject' => false,
                         'Depth' => false,
                         'Limitation' => array() ); // Empty array means no permission checking
        $subtreeCount = $node->subTreeCount( $params );
        while ( $offset < $subtreeCount )
        {
            $params['Offset'] = $offset;
            $params['Limit'] = $limit;

            $subtreeChunk = $node->subTree( $params );
            $nNodesInChunk = count( $subtreeChunk );
            $offset += $nNodesInChunk;
            if ( $nNodesInChunk == 0 )
                break;

            $objectIDList = array();
            foreach ( $subtreeChunk as $curNode )
                $objectIDList[] = $curNode['id'];
            unset( $subtreeChunk );

            eZContentCacheManager::clearContentCacheIfNeeded( array_unique( $objectIDList ) );
        }

        return true;
    }
530236
def clear_caches(self):
        
        for element_name in dir(self.components):
            element = getattr(self.components, element_name)
            if hasattr(element, 'cache_val'):
                delattr(element, 'cache_val')
110543
function(){
    var i;
    var args = slice(arguments);
    var length = args.length;

    if (length > 0){
      for(i=0; i<length; i++){
        delete this.templateCaches[args[i]];
      }
    } else {
      this.templateCaches = {};
    }
  }
638209
public void cleanup() {
		long currentTime = System.currentTimeMillis();

		// remove entries which have exceeded their time to live
		cachedExecutionGraphs.values().removeIf(
			(ExecutionGraphEntry entry) -> currentTime >= entry.getTTL());
	}
1052284
protected void sweepCache() {
        for (Iterator keyIterator = keySet().iterator(); keyIterator.hasNext(); ) {
            Object key = keyIterator.next();
            ValueWrapper valueWrapper = (ValueWrapper) super.get(key);
            long creationTime = valueWrapper.getCreationTime();
            long cacheInterval = valueWrapper.getCacheInterval();
            long currentTime = System.currentTimeMillis();
            if (cacheInterval >= 0 && creationTime + cacheInterval < currentTime) {
                remove(key);
            }
        }
    }
273627
function cleanupCache() {
  const cacheLocation = getUserCachePath(this.options);
  if (fse.existsSync(cacheLocation)) {
    if (this.serverless) {
      this.serverless.cli.log(`Removing static caches at: ${cacheLocation}`);
    }

    // Only remove cache folders that we added, just incase someone accidentally puts a weird
    // static cache location so we don't remove a bunch of personal stuff
    const promises = [];
    glob
      .sync([path.join(cacheLocation, '*slspyc/')], { mark: true, dot: false })
      .forEach(file => {
        promises.push(fse.removeAsync(file));
      });
    return BbPromise.all(promises);
  } else {
    if (this.serverless) {
      this.serverless.cli.log(`No static cache found`);
    }
    return BbPromise.resolve();
  }
}