tests to see if we should flush cache
6295
@Override
    public synchronized void run(){
        Date now = new Date();
        if ( !cache.isEmpty() &&
                ((cache.size() > cacheSize - 1) || (now.getTime() - lastCacheAccess.getTime() > cacheMillis))) {
            try {
                flush();
            } catch (RepositoryException e) {
                log.error(e.getLocalizedMessage());
                throw new RuntimeException(e);
            } catch (MalformedQueryException e) {
                log.error(e.getLocalizedMessage());
                throw new RuntimeException(e);
            } catch (UpdateExecutionException e) {
                log.error(e.getLocalizedMessage());
                throw new RuntimeException(e);
            } catch (IOException e) {
                log.error(e.getLocalizedMessage());
                throw new RuntimeException(e);
            }
        }
    }
320973
def evaluate_cached(self, **kwargs):
        """"""
        if not hasattr(self, 'result'):
            self.result = self.evaluate(cache=True, **kwargs)

        return self.result
1029979
def should_cache(self, request, response):
        

        if not getattr(request, '_cache_update_cache', False):
            return False
        if not response.status_code in getattr(settings, 'BETTERCACHE_CACHEABLE_STATUS', CACHEABLE_STATUS):
            return False
        if getattr(settings, 'BETTERCACHE_ANONYMOUS_ONLY', False) and self.session_accessed and request.user.is_authenticated:
            return False
        if self.has_uncacheable_headers(response):
            return False
        return True
251891
def _flush(self, commit=True, using=None):
        
        if commit:
            # XXX: multi-set?
            if self._uses_savepoints():
                self._commit_all_savepoints(using)
            c = self.local.mget('%s_%s_*' %
                                (self.prefix, self._trunc_using(using)))
            for key, value in c.items():
                self.cache_backend.set(key, value, self.timeout)
        else:
            if self._uses_savepoints():
                self._rollback_all_savepoints(using)
        self._clear(using)
        self._clear_sid_stack(using)
633812
public function flushCache()
    {
        $finder = new Finder();

        foreach ($finder->files()->in($this->cacheDir)->name('*.php') as $file) {
            unlink($file->getRealpath());
        }

        return true;
    }
475427
def flush(bank, key=None, cachedir=None):
    '''
    
    '''
    if cachedir is None:
        cachedir = __cachedir()

    try:
        if key is None:
            target = os.path.join(cachedir, os.path.normpath(bank))
            if not os.path.isdir(target):
                return False
            shutil.rmtree(target)
        else:
            target = os.path.join(cachedir, os.path.normpath(bank), '{0}.p'.format(key))
            if not os.path.isfile(target):
                return False
            os.remove(target)
    except OSError as exc:
        raise SaltCacheError(
            'There was an error removing "{0}": {1}'.format(
                target, exc
            )
        )
    return True
628555
static public function flushRoutesCache()
    {
        $cachePath = Config::getCommon('router.cache_file');
        if (FileHelper::delete($cachePath)) {
            return ErrorInfo::success('flush routes cache success');
        } else {
            return ErrorInfo::error('flush routes cache fail, please check config[router.cache_file]');
        }
    }
605409
def has(self):
        """"""
        self._done = os.path.exists(self._cache_file)
        return self._done or self._out is not None
325980
public function flush()
    {
        // this may take a while, but they shouldn't be flushing in production
        $cache_keys = $this->redis->keys(/* prefixed with cache: */ '*');

        foreach ($cache_keys as $key) {
            $this->redis->del($key);
        }

        unset($cache_keys);

        return true;
    }
945461
private static boolean ifExistsAndFresh(Configuration conf, FileSystem fs,
                                          URI cache, long confFileStamp,
                                          CacheStatus lcacheStatus,
                                          FileStatus fileStatus)
  throws IOException {
    // check for existence of the cache
    long dfsFileStamp;
    if (fileStatus != null) {
      dfsFileStamp = fileStatus.getModificationTime();
    } else {
      dfsFileStamp = getTimestamp(conf, cache);
    }

    // ensure that the file on hdfs hasn't been modified since the job started
    if (dfsFileStamp != confFileStamp) {
      LOG.fatal("File: " + cache + " has changed on HDFS since job started");
      throw new IOException("File: " + cache +
          " has changed on HDFS since job started");
    }

    if (dfsFileStamp != lcacheStatus.mtime) {
      // needs refreshing
      return false;
    }

    return true;
  }
687182
protected void checkCacheVersion() {
        // Be very aggressive in invalidating the cache.
        boolean invalidate = true;
        try {
            Get get = new Get.Builder(getDefaultIndexName(), "instance").type("dataVersion").build(); //$NON-NLS-1$ //$NON-NLS-2$
            JestResult result = getClient().execute(get);
            if (result.isSucceeded()) {
                String latestDV = result.getJsonObject().get("_version").getAsString(); //$NON-NLS-1$
                if (latestDV != null && dataVersion != null && latestDV.equals(dataVersion)) {
                    invalidate = false;
                } else {
                    dataVersion = latestDV;
                }
            }
        } catch (IOException e) {
            logger.warn("Elasticsearch is not available, using cache");
            invalidate = false;
        }
        if (invalidate) {
            invalidateCache();
        }
    }
168763
def flush_at(next_flush, base = nil)
    @cache.each do |key, entry|
      next if base and not base === key
      entry.expire_at(next_flush)
    end
  end
604408
public function getCacheIsReady(): bool
    {
        foreach ($this->caches as $cache) {
            if (!$cache->getCacheIsReady()) {
                return false;
            }
        }

        return true;
    }
222858
def dirty(self):
      """"""
      return not os.path.exists(self.cachename) or \
            (os.path.getmtime(self.filename) >
             os.path.getmtime(self.cachename))
1028056
def flush_cache
      Rails.cache.delete([self.class.name, symbol_was.to_s])
      Rails.cache.delete([self.class.name, id])
    end
120679
void flushCache() {

        float age = (System.currentTimeMillis() - m_dateField.getDate().getTime()) / (60f * 60f * 1000f);
        OpenCms.fireCmsEvent(
            new CmsEvent(
                I_CmsEventListener.EVENT_CLEAR_CACHES,
                Collections.<String, Object> singletonMap(CmsImageLoader.PARAM_CLEAR_IMAGES_CACHE, "" + age)));
    }
324528
public function flush()
    {
        $i = 0;
        $count = $this->count();

        while ($i < $count) {
            if (xcache_clear_cache(XC_TYPE_VAR, $i) === false) {
                return false;
            }

            $i++;
        }

        return true;
    }