This is called at the beginning of a provisioning operation. It re-initializes
or refreshes the cache against what is known in the filesystem.
<p>
Note that for update operations (rather than initial provisioning), cachedFeatures will
be pre-populated..
499825
public void init() {
        isDirty = false;

        // If we haven't looked at anything from the cache or the filesystem, this is bootstrap time
        boolean firstInit = cachedFeatures.isEmpty();

        autoFeatures = new ArrayList<SubsystemFeatureDefinitionImpl>();
        knownFeatures = new HashMap<File, SubsystemFeatureDefinitionImpl>();
        knownBadFeatures = new HashMap<File, BadFeature>();

        // Read feature cache, this will only toss files that no longer exist
        // stale will be marked true if feature definitions were discarded.
        readCache(firstInit);

        // Now we need to go find / update the cache with anything new/interesting/different.
        // This will happen at most twice...
        readFeatureManifests();

        // If something was out of sync with the filesystem and this is the first pass,
        // reset the installed features list so we re-figure out what should be installed.
        if (isDirty && firstInit) {
            // If stale, reset to empty list as we'll be rebuilding....
            installedFeatures = Collections.emptySet();
            configuredFeatures = Collections.emptySet();
        }
    }
877401
private synchronized void refreshCachedData() throws IOException {
    IOUtils.closeStream(committedTxnId);
    
    File currentDir = journalStorage.getSingularStorageDir().getCurrentDir();
    this.lastPromisedEpoch = new PersistentLongFile(
        new File(currentDir, LAST_PROMISED_FILENAME), 0);
    this.lastWriterEpoch = new PersistentLongFile(
        new File(currentDir, LAST_WRITER_EPOCH), 0);
    this.committedTxnId = new BestEffortLongFile(
        new File(currentDir, COMMITTED_TXID_FILENAME),
        HdfsConstants.INVALID_TXID);
    metrics.lastWriterEpoch.set(lastWriterEpoch.get());
  }
514582
public boolean enableDiskCache(Context context, int storageDevice) {
        Context appContext = context.getApplicationContext();

        String rootDir = null;
        if (storageDevice == DISK_CACHE_SDCARD
                && Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
            // SD-card available
            rootDir = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/"
                    + appContext.getPackageName() + "/cache";
        } else {
            File internalCacheDir = appContext.getCacheDir();
            // apparently on some configurations this can come back as null
            if (internalCacheDir == null) {
                return (isDiskCacheEnabled = false);
            }
            rootDir = internalCacheDir.getAbsolutePath();
        }

        setRootDir(rootDir);

        File outFile = new File(diskCacheDirectory);
        if (outFile.mkdirs()) {
            File nomedia = new File(diskCacheDirectory, ".nomedia");
            try {
                nomedia.createNewFile();
            } catch (IOException e) {
                Log.e(LOG_TAG, "Failed creating .nomedia file");
            }
        }

        isDiskCacheEnabled = outFile.exists();

        if (!isDiskCacheEnabled) {
            Log.w(LOG_TAG, "Failed creating disk cache directory " + diskCacheDirectory);
        } else {
            //Log.d(name, "enabled write through to " + diskCacheDirectory);

            // sanitize disk cache
            //Log.d(name, "sanitize DISK cache");
            sanitizeDiskCache();
        }

        return isDiskCacheEnabled;
    }
139797
@Override public void onAck() {
    if( _val != null ) {        // Set transient fields after deserializing
      assert !_xkey.home() && _val._key == null;
      _val._key = _xkey;
    }
    // Now update the local store, caching the result.

    // We only started down the TGK path because we missed locally, so we only
    // expect to find a NULL in the local store.  If somebody else installed
    // another value (e.g. a racing TGK, or racing local Put) this value must
    // be more recent than our NULL - but is UNORDERED relative to the Value
    // returned from the Home.  We'll take the local Value to preserve ordering
    // and rely on invalidates from Home to force refreshes as needed.

    // Hence we can do a blind putIfMatch here over a null or empty Value
    // If it fails, what is there is also the TGK result.
    Value old = H2O.STORE.get(_xkey);
    if( old != null && !old.isEmpty() ) old=null;
    Value res = H2O.putIfMatch(_xkey,_val,old);
    if( res != old ) _val = res;
    TGKS.remove(_xkey); // Clear from dup cache
  }
30682
@Override
	protected void resetCache() {
		super.resetCache();
		cacheProperties.put(JawrConstant.SASS_GENERATOR_URL_MODE,
				useAbsoluteURL ? SASS_GENERATOR_ABSOLUTE_URL_MODE : SASS_GENERATOR_RELATIVE_URL_MODE);
	}
450393
public boolean isFresh(final String filename) {
        final FileSystem fileSystem = vertx.fileSystem();

        try {
            FileProps fileProps = fileSystem.propsBlocking(filename);
            LRUCache.CacheEntry<String, T> cacheEntry = cache.get(filename);
            final long lastModified = fileProps.lastModifiedTime();

            if (cacheEntry == null) {
                return false;
            }
            if (cacheEntry.isFresh(lastModified)) {
                return true;
            }
            // not fresh anymore, purge it
            cache.remove(filename);
            return false;
        } catch (RuntimeException e) {
            return false;
        }
    }
21529
void imageLoaded() throws IOException {
    for (Future<Void> task : cachingTasks) {
      try {
        task.get();
      } catch (InterruptedException e) {
        throw new IOException("FSDirectory cache received interruption");
      } catch (ExecutionException e) {
        throw new IOException(e);
      }
    }
    
    // will not be used after startup
    this.cachingTasks = null;
    this.cachingExecutor.shutdownNow();
    this.cachingExecutor = null;
    
    // process remaining inodes
    for(INode inode : cachingTempQueue) {
      cacheNameInternal(inode);
    }
    this.cachingTempQueue = null;
    
    this.imageLoaded = true;
  }
86956
public void cacheCleared(String cacheName) {
            InvalidationTableList list = (InvalidationTableList) cacheinvalidationTables.get(cacheName);
            if (list != null ) 
                    list.clear();
	}
959617
public void refreshCache(String cacheName, List<String> excludedFormats) {
        CacheService cache = allCaches.get(cacheName);
        if (cache != null) {
            if (excludedFormats != null && cache instanceof ExcludableCache && excludedFormats.contains(((ExcludableCache)cache).getFormat())) {
                logger.debug(" - omitting cache " + cacheName);
            }
            else {
                logger.info(" - refresh cache " + cacheName);
                try {
                    cache.refreshCache();
                } catch (Exception e) {
                    logger.severeException("failed to refresh cache", e);
                }
            }
        }
    }
1234728
public void initialise(Identifier rootId, boolean enableCache)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      tc.entry(cclass, "initialise", new Object[] {rootId, new Boolean(enableCache)});

    switch (rootId.getType()) {
      case Selector.UNKNOWN :
      case Selector.OBJECT :
        matchTree = new EqualityMatcher(rootId);
        break;
      case Selector.STRING :
      case Selector.TOPIC :
        matchTree = new StringMatcher(rootId);
        break;
      case Selector.BOOLEAN :
        matchTree = new BooleanMatcher(rootId);
        break;
      default:
        matchTree = new NumericMatcher(rootId);
        break;
    }
    if (enableCache) {
      this.rootId = rootId;
      matchCache = new MatchCache(MATCH_CACHE_INITIAL_CAPACITY);
      matchCache.setRehashFilter(this);
      ((EqualityMatcher) matchTree).setCacheing(true);
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      tc.exit(cclass, "MatchSpaceImpl", this);
  }
632126
@SuppressWarnings({ "unchecked" })
    /* package */<T> HystrixCachedObservable<T> putIfAbsent(String cacheKey, HystrixCachedObservable<T> f) {
        ValueCacheKey key = getRequestCacheKey(cacheKey);
        if (key != null) {
            /* look for the stored value */
            ConcurrentHashMap<ValueCacheKey, HystrixCachedObservable<?>> cacheInstance = requestVariableForCache.get(concurrencyStrategy);
            if (cacheInstance == null) {
                throw new IllegalStateException("Request caching is not available. Maybe you need to initialize the HystrixRequestContext?");
            }
            HystrixCachedObservable<T> alreadySet = (HystrixCachedObservable<T>) cacheInstance.putIfAbsent(key, f);
            if (alreadySet != null) {
                // someone beat us so we didn't cache this
                return alreadySet;
            }
        }
        // we either set it in the cache or do not have a cache key
        return null;
    }
1344487
protected function BeforeInit()
    {
        //todo: check access rights
        $cacheFile = PathUtil::ContentCacheFile($this);
        $this->fileCacher = new FileCacher($cacheFile, $this->content->GetCacheLifetime());
        if ($this->fileCacher->MustUseCache())
        {
            $this->output = $this->fileCacher->GetFromCache();
            return true;
        }
        return parent::BeforeInit();
    }
854585
private static void cacheOnStart()
    {
        try {
            boolean closeContext = false;
            if (!Context.isThreadActive()) {
                Context.begin();
                closeContext = true;
            }
            Context.getThreadContext();
            final Connection con = Context.getConnection();
            final PreparedStatement stmtLang = con.prepareStatement(DBProperties.SQLLANG);
            final ResultSet rsLang = stmtLang.executeQuery();
            final Set<String> languages = new HashSet<>();
            while (rsLang.next()) {
                languages.add(rsLang.getString(1).trim());
            }
            rsLang.close();
            stmtLang.close();
            final Cache<String, String> cache = InfinispanCache.get().<String, String>getCache(
                            DBProperties.CACHENAME);
            final PreparedStatement stmt = con.prepareStatement(DBProperties.SQLSELECTONSTART);
            final ResultSet resultset = stmt.executeQuery();
            while (resultset.next()) {
                final String propKey = resultset.getString(1).trim();
                final String defaultValue = resultset.getString(2);
                if (defaultValue != null) {
                    final String value = defaultValue.trim();
                    for (final String lang : languages) {
                        final String cachKey = lang + ":" + propKey;
                        if (!cache.containsKey(cachKey)) {
                            cache.put(cachKey, value);
                        }
                    }
                }
                final String value = resultset.getString(3);
                final String lang = resultset.getString(4);
                if (value != null) {
                    final String cachKey = lang.trim() + ":" + propKey;
                    cache.put(cachKey, value.trim());
                }
            }
            resultset.close();
            stmt.close();
            con.commit();
            con.close();
            if (closeContext) {
                Context.rollback();
            }
        } catch (final EFapsException e) {
            DBProperties.LOG.error("initialiseCache()", e);
        } catch (final SQLException e) {
            DBProperties.LOG.error("initialiseCache()", e);
        }
    }
154742
public function initialize()
    {
        if ((false === $this->exists($this->localPath)) && false === $this->filesystem->createDir($this->localPath)) {
            throw new RuntimeException(
                'Unable to create a local storage for temporary filesystem operations.'
            );
        }

        $this->initialized = true;
    }
1052747
protected boolean fillByteCache(WsByteBuffer buff) {
        if (this.bytePosition < this.byteLimit) {
            return false;
        }

        int size = buff.remaining();
        if (size > this.byteCacheSize) {
            // truncate to just fill up the cache
            size = this.byteCacheSize;
        }
        this.bytePosition = 0;
        this.byteLimit = size;
        if (0 == this.byteLimit) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "fillByteCache: no data");
            }
            return false;
        }
        if (HeaderStorage.NOTSET != this.headerChangeLimit && -1 != this.parseIndex
            && -1 == this.parseBuffersStartPos[this.parseIndex]) {
            // first occurrance of this buffer and we're keeping track of changes
            this.parseBuffersStartPos[this.parseIndex] = buff.position();
        }
        buff.get(this.byteCache, this.bytePosition, this.byteLimit);

        return true;
    }
849094
private synchronized void initSystemCache() {
        List<StoreDefinition> value = storeMapper.readStoreList(new StringReader(SystemStoreConstants.SYSTEM_STORE_SCHEMA));
        metadataCache.put(SYSTEM_STORES_KEY, new Versioned<Object>(value));
    }
351293
@Override
   public void cacheStarting(ComponentRegistry cr, Configuration cfg, String cacheName) {
      BasicComponentRegistry gcr = cr.getGlobalComponentRegistry().getComponent(BasicComponentRegistry.class);
      InternalCacheRegistry icr = gcr.getComponent(InternalCacheRegistry.class).running();
      if (!icr.isInternalCache(cacheName)) {
         ProtobufMetadataManagerImpl protobufMetadataManager =
            (ProtobufMetadataManagerImpl) gcr.getComponent(ProtobufMetadataManager.class).running();
         protobufMetadataManager.addCacheDependency(cacheName);

         SerializationContext serCtx = protobufMetadataManager.getSerializationContext();
         RemoteQueryManager remoteQueryManager = buildQueryManager(cfg, serCtx, cr);
         cr.registerComponent(remoteQueryManager, RemoteQueryManager.class);

      }
   }