The refresh interval of the authentication cache should be configurable. Since
this is running inside a cloud app the best option is th use an environment
variable.
@returns {*}
420547
function getCacheRefreshInterval() {
    var value = parseInt(process.env[CACHE_REFRESH_KEY]);

    // Should we 0 here to invalidate the cache immediately?
    if (value && !isNaN(value) && value > 0) {
      return value;
    }

    return DEFAULT_CACHE_REFRESH_SECONDS;
  }
881110
function() {
    var contents = this.contents;
    var startIdx = this.startIdx + contents.match(/^\s*/)[0].length;
    var endIdx = this.endIdx - contents.match(/\s*$/)[0].length;
    return new Interval(this.sourceString, startIdx, endIdx);
  }
1043191
private HeaderCacheElement syncRefresh(long timeout, TimeUnit timeUnit) {
    Span span = TRACER.spanBuilder("Bigtable.CredentialsRefresh").startSpan();
    try (Scope scope = TRACER.withSpan(span)) {
      return asyncRefresh().get(timeout, timeUnit);
    } catch (InterruptedException e) {
      LOG.warn("Interrupted while trying to refresh google credentials.", e);
      Status status = Status.UNAUTHENTICATED
          .withDescription("Authentication was interrupted.")
          .withCause(e);
      span.setStatus(StatusConverter.fromGrpcStatus(status));
      Thread.currentThread().interrupt();
      return new HeaderCacheElement(status);
    } catch (ExecutionException e) {
      LOG.warn("ExecutionException while trying to refresh google credentials.", e);
      Status status = Status.UNAUTHENTICATED
          .withDescription("ExecutionException during Authentication.")
          .withCause(e);
      span.setStatus(StatusConverter.fromGrpcStatus(status));
      return new HeaderCacheElement(status);
    } catch (TimeoutException e) {
      LOG.warn("TimeoutException while trying to refresh google credentials.", e);
      Status status = Status.UNAUTHENTICATED
          .withDescription("TimeoutException during Authentication.")
          .withCause(e);
      span.setStatus(StatusConverter.fromGrpcStatus(status));
      return new HeaderCacheElement(status);
    } catch (Exception e) {
      LOG.warn("Unexpected execption while trying to refresh google credentials.", e);
      Status status = Status.UNAUTHENTICATED
          .withDescription("Unexpected execption during Authentication.")
          .withCause(e);
      span.setStatus(StatusConverter.fromGrpcStatus(status));
      return new HeaderCacheElement(status);
    } finally {
      span.end();
    }
  }
44965
function() {
            logging.log("Run application", this.name);

            var hr = require("hr/hr");
            hr.Cache.init();
            hr.app = this;

            this.update();
            return this;
        }
801024
@Api
	public void refresh() {
		if (state == State.INITIALIZED) { // to prevent refresh before the map is drawn
			state = State.REFRESHING;
			clear();
			ClientConfigurationService.clear(); // refresh because configuration changed, clear cache
			refreshFromConfiguration();
		}
	}
293291
function () {
                var refreshMgrInfo = this._refreshMgrInfo;
                if (!refreshMgrInfo) {
                    refreshMgrInfo = {
                        refreshArgs : null,
                        queue : []
                        // queue is used in the repeater
                    };
                    this._refreshMgrInfo = refreshMgrInfo;
                    aria.templates.RefreshManager.queue({
                        fn : this._refreshManagerCallback,
                        scope : this
                    }, this);
                }
                return refreshMgrInfo;
            }
251520
def _refresh_buckets_cache_file(creds, cache_file, multiple_env, environment, prefix):
    '''
    
    '''

    # helper s3 query function
    def __get_s3_meta():
        return __utils__['s3.query'](
            key=creds.key,
            keyid=creds.keyid,
            kms_keyid=creds.kms_keyid,
            bucket=creds.bucket,
            service_url=creds.service_url,
            verify_ssl=creds.verify_ssl,
            location=creds.location,
            return_bin=False,
            params={'prefix': prefix},
            path_style=creds.path_style,
            https_enable=creds.https_enable)

    # grab only the files/dirs in the bucket
    def __get_pillar_files_from_s3_meta(s3_meta):
        return [k for k in s3_meta if 'Key' in k]

    # pull out the environment dirs (e.g. the root dirs)
    def __get_pillar_environments(files):
        environments = [(os.path.dirname(k['Key']).split('/', 1))[0] for k in files]
        return set(environments)

    log.debug('Refreshing S3 buckets pillar cache file')

    metadata = {}
    bucket = creds.bucket

    if not multiple_env:
        # Single environment per bucket
        log.debug('Single environment per bucket mode')

        bucket_files = {}
        s3_meta = __get_s3_meta()

        # s3 query returned something
        if s3_meta:
            bucket_files[bucket] = __get_pillar_files_from_s3_meta(s3_meta)

            metadata[environment] = bucket_files

    else:
        # Multiple environments per buckets
        log.debug('Multiple environment per bucket mode')
        s3_meta = __get_s3_meta()

        # s3 query returned data
        if s3_meta:
            files = __get_pillar_files_from_s3_meta(s3_meta)
            environments = __get_pillar_environments(files)

            # pull out the files for the environment
            for saltenv in environments:
                # grab only files/dirs that match this saltenv.
                env_files = [k for k in files if k['Key'].startswith(saltenv)]

                if saltenv not in metadata:
                    metadata[saltenv] = {}

                if bucket not in metadata[saltenv]:
                    metadata[saltenv][bucket] = []

                metadata[saltenv][bucket] += env_files

    # write the metadata to disk
    if os.path.isfile(cache_file):
        os.remove(cache_file)

    log.debug('Writing S3 buckets pillar cache file')

    with salt.utils.files.fopen(cache_file, 'w') as fp_:
        pickle.dump(metadata, fp_)

    return metadata
387720
function() {
            if (!this.available) return;

            if (window.applicationCache.status === window.applicationCache.UPDATEREADY) {
                this.trigger("update");
            }
            return window.applicationCache.status === window.applicationCache.UPDATEREADY;
        }
950300
function SessionStorage_construct(config) {
        this.timeouts = {};
        this.config = core.extend(
            {
                cookieKey: 'session_id',
                time: 60 * 20 * 1000, // 20 min default session time
                storage: null,
                key_prefix: 'SESSION_ID_KEY_'
            },
            config
        );

        if (!this.config.storage) {
            this.config.storage = cache;
        } else if (Type.isString(this.config.storage)) {
            this.config.storage = di.load(this.config.storage);
        }

        if(!(this.config.storage instanceof StorageInterface)) {
            throw new error.HttpError(500, this.config, 'Session storage must be instance of interface/storage');
        }
    }
324045
function() {
      var bar = '|';

      var userAgent = browserData.ua;
      var screenPrint = this.getScreenPrint();
      var pluginList = this.getPlugins();
      var fontList = this.getFonts();
      var localStorage = this.isLocalStorage();
      var sessionStorage = this.isSessionStorage();
      var timeZone = this.getTimeZone();
      var language = this.getLanguage();
      var systemLanguage = this.getSystemLanguage();
      var cookies = this.isCookie();
      var canvasPrint = this.getCanvasPrint();

      var key = userAgent + bar + screenPrint + bar + pluginList + bar + fontList + bar + localStorage + bar + sessionStorage + bar + timeZone + bar + language + bar + systemLanguage + bar + cookies + bar + canvasPrint;
      var seed = 256;

      return murmurhash3_32_gc(key, seed);
    }
1056262
function lastRefreshInsertionPoint() {
                    var slotNext = refreshEnd;
                    while (!slotNext.firstInSequence) {
                        slotNext = slotNext.prev;

                        if (slotNext === refreshStart) {
                            return null;
                        }
                    }

                    return slotNext;
                }
1128642
function() {
      var auth = this._auth;

      return this._q(function(resolve) {
        var off;
        function callback() {
          // Turn off this onAuthStateChanged() callback since we just needed to get the authentication data once.
          off();
          resolve();
        }
        off = auth.onAuthStateChanged(callback);
      });
    }
555738
function backgroundRefresh(){
    for(key in refreshKeys){
      if(refreshKeys.hasOwnProperty(key)){
        var data = refreshKeys[key];
        if(data.expiration - Date.now() < self.backgroundRefreshMinTtl){
          data.refresh(key, function (err, response){
            if(!err){
              self.set(key, response, data.lifeSpan, data.refresh, noop);
            }
          });
        }
      }
    }
  }
570590
private synchronized void refreshAccessToken() throws ConnectionException, HTTPException {
        if (!isTokenExpired()) {
            return;
        }

        Map<String, String> params = new HashMap<>();
        params.put(Constants.PARAM_CLIENT_ID, clientId);
        params.put(Constants.PARAM_CLIENT_SECRET, clientSecret);

        if (isUserAuthFlow() && accessToken.getRefreshToken() != null) {
            // For user based authentication, refresh the token
            params.put(Constants.PARAM_GRANT_TYPE, Constants.GRANT_TYPE_REFRESH_TOKEN);
            params.put(Constants.PARAM_REFRESH_TOKEN, accessToken.getRefreshToken());

        } else {
            // For app based authentication, reload the token
            params.put(Constants.PARAM_GRANT_TYPE, Constants.GRANT_TYPE_CLIENT_CREDENTIALS);
        }

        loadAccessToken(params);
    }
1355331
def _caching_enabled(self):
        """"""
        try:
            config = self._runtime.get_configuration()
            parameter_id = Id('parameter:useCachingForQualifierIds@json')
            if config.get_value_by_parameter(parameter_id).get_boolean_value():
                return True
            else:
                return False
        except (AttributeError, KeyError, errors.NotFound):
            return False
317650
function cacheClient (cacheClient) {
    if (defined(cacheClient)) {
        // validate that cache client has required methods
        requireValidCacheClient(cacheClient)
        // set default
        immutable.defaultCacheClient = cacheClient
        // return immutable
        return ImmutableCore
    }
    // return default value
    return immutable.defaultCacheClient
}
710303
function(location) {
		var deferred = new Deferred();
		this._busyWhile(deferred, messages["Loading..."]);
		this._siteClient.loadSiteConfiguration(location).then(
			function(siteConfig) {
				this._setSiteConfiguration(siteConfig);
				this.setDirty(false);
				deferred.resolve(siteConfig);
			}.bind(this),
			function(error) {
				deferred.reject(error);
			});
		return deferred;
	}