Determine if the cached representation is fresh.

@param {object} req
@param {object} res
@return {boolean}
@private
505295
function isFresh (req, res) {
  return fresh(req.headers, {
    'etag': res.getHeader('ETag'),
    'last-modified': res.getHeader('Last-Modified')
  })
}
1163071
function Q(redisClient, key) {
  // handle forgetting a 'new'
  if (!(this instanceof Q)) {
    return new Q(redisClient, key);
  }

  this._redis = redisClient;
  this._key = key;
}
1133566
def isFresh(self):
        ""
        max_age = self.getMaxAge()
        date = self.getDate()
        is_fresh = False
        if max_age and date:
            delta_time = datetime.now() - date
            is_fresh = delta_time.total_seconds() < max_age
        return is_fresh
64826
function resolve(deps, rem) {
    var i, length, dep, mod, result = [];

    for (i = 0, length = deps.length; i < length; i++) {
      dep = deps[i];
      mod = cache[dep] || rem[dep];

      if (!mod) {
        throw new TypeError("Module " + dep + " has not yet been loaded");
      }

      if (cache[dep]) {
        if (!mod.hasOwnProperty("code")) {
          mod.code = load(mod);
        }
        result[i] = mod.code;
      }
      else {
        result[i] = mod;
      }
    }

    return result;
  }
1006721
boolean isJsCached(Method nonProxiedMethod) {
		boolean cached = nonProxiedMethod.isAnnotationPresent(JsCacheResult.class);
		logger.debug("The result of the method {} should be cached on client side {}.", nonProxiedMethod.getName(), cached);
		return cached;
	}
1353097
function cleanRes (res) {
    return {
        body: res.body,
        rawHeaders: res.rawHeaders,
        statusCode: res.statusCode,
    }
}
565728
function cacheQuery () {
    // debug
    debug('view:id:collection:get', this.idCacheKey, this.ids)
    // attempt to get from cache
    return this.cache.redis.getAsync(this.idCacheKey)
    // check result
    .then(cached => this.cacheQueryResult(cached))
}
1105265
function (req, res) {
	if (req.body) {
		//console.log(req.body.constructor)
		if (req.body.constructor !== Object) {return res.send({error:"Invalid Request body - should be Object"})};
	}
	var table = req.params["0"];
	var rcfg  = process.rapidcfg;
        var rmethod = req.method
	var extname = ""
	/* code for database distribution here ! */
	function GetUserDistName(lcstring){ return utils.hash(lcstring,1).toLowerCase()}		
	/* end */
	/* code for REDIS distribution here ! */
	function GetUserDistCache(lcstring){ return utils.hash(lcstring,1).toLowerCase()}		
	/* end */ 
	// check for table
	var accepted_list = rcfg.mdb.tables.names.slice(0);;
	accepted_list.push('up_data');
	accepted_list.push('up_tdata');
	accepted_list.push('rpdquery');
	if (utils.findin(accepted_list,table)){
		var primary_key = rcfg.mdb.tables.keys[table]
		if(!primary_key){
			if (table!='up_data' && table!='up_tdata' && table!='rpdquery'){
			return res.send({error:"Table - "+table+" - primary key not found in database!"})};
		} else {
		var dbcon = {};
		var rediscon = {};
		var base_db = rcfg.mdb.tables.db[table];
		if (rcfg.distributeddata == 1 && rcfg.mdb.databases[base_db].distributeddata==1){
			//extname = GetUserDistName(req.session.username.toLowerCase());
			//var dist_db = base_db +'_'+extname;
			//console.log(rcfg.mdb.databases[base_db].distributeddata)
			//req.session.username
			var dist_db = dbs.getdbdist(base_db,req.token.user);
			dbcon = rcfg.mdb.connections[dist_db];
			dbcon.rapiddb = dist_db
		} else {dbcon = rcfg.mdb.databases[base_db];dbcon.rapiddb = base_db};
		//console.log(dbcon);
		if (rcfg.distributedcache == 1){
			//req.session.username
			redisname = GetUserDistCache(req.token.user.toLowerCase());
			//console.log(redisname);
			rediscon  = rcfg.mdb.redis[redisname];
		};
		//console.log(rediscon);
		var table_structure = rcfg.mdb.tables.structures[table] }
		function rdbcallback(error,message){
			//console.log('Callback:');
			if (error){
				if(error){console.log(error)};
				//console.log(typeof(error.error));
				//console.log(Object.keys(error.error).length);
				res.status(400);
				return res.send(error)} 
			else {
				//console.log(message);
				return res.send(message)}
			};
		function rapidfind(){
			if (table == 'rpdquery'){
				rdb.runsql(req,rdbcallback);
			} else {
				if (req.query[primary_key]){
					rdb.find(req,table,primary_key,table_structure,dbcon,rediscon,rdbcallback);
				} else {
				//res.status(400);return res.send({error:'Query error/Primary key not found in GET:Query parameters'})
				rdb.find(req,table,false,table_structure,dbcon,rediscon,rdbcallback);
				}
			}
		};
		function rapidcreate(){
			if (req.body){
				function defaultcreate(){rdb.create(req,table,primary_key,table_structure,dbcon,rediscon,rdbcallback)}
				function up_data(){rdb.dataset(req,false,rdbcallback)}
				function up_tdata(){rdb.dataset(req,true,rdbcallback)}
				switch (table) {
				case 'up_tdata':
					if (rcfg.mdb.tables.structures[table]){
					if (Object.keys(req.body).length > 1){
						defaultcreate();
					}else {up_tdata}} else {
					up_tdata()};
					break;
				case 'up_data':
					if (rcfg.mdb.tables.structures[table]){
					if (Object.keys(req.body).length > 1){
						defaultcreate();
					}else {up_data()}} else {
					up_data()};
					break;
				default: defaultcreate()};
			} else {res.status(400);return res.send({error:'Query error/No parameters found-POST:Body/required format JSON'})}
		};
		function rapidupdate(){
			if (req.body[primary_key]){
				rdb.update(req,table,primary_key,table_structure,dbcon,rediscon,rdbcallback)
			} else {res.status(400);return res.send({error:'Query error/Primary key not found in PUT:Body parameters'})}
		};
		function rapiddelete(){
			var key_value = false
			var key_value = req.query[primary_key]
			if (!key_value){key_value = req.body[primary_key]}
			if (key_value){
				rdb.destroy(req,table,primary_key,table_structure,dbcon,key_value,rediscon,rdbcallback)
			} else {res.status(400);return res.send({error:'Query error/Primary key not found in DELETE:Query parameters'})}
		};
		switch (rmethod) {
	    	case 'GET':rapidfind();break;
	    	case 'POST':rapidcreate();break;
		case 'PUT':rapidupdate();break;
		case 'DELETE':rapiddelete();break;
	    	default:
			return res.send({error:"Method - "+req.method+" - not alowed!"});
		} 
	} else { return res.send({error:"Table - "+ table+" - not found!"})}; // code for waterline redirect here !
  }
902502
function fresh (url, parsedUrl) {
  return typeof parsedUrl === 'object' &&
    parsedUrl !== null &&
    (Url === undefined || parsedUrl instanceof Url) &&
    parsedUrl._raw === url
}
924108
function Request_isHeaderCacheUnModified() {

        var etagMatches = true,
            notModified = true,
            modifiedSince = this.getRequestHeader('if-modified-since'),
            noneMatch = this.getRequestHeader('if-none-match'),
            cc = this.getRequestHeader('cache-control'),
            lastModified = this.getHeader('last-modified'),
            etag = this.getHeader('etag');


        // unconditional request
        if (!modifiedSince && !noneMatch) {
            return false;
            // check for no-cache cache request directive
        } else if (cc && cc.indexOf('no-cache') !== -1) {
            return false;
        }

        // parse if-none-match
        if (noneMatch) {
            noneMatch = noneMatch.split(/ *, */);
        }
        // if-none-match
        if (noneMatch) {
            etagMatches = ~noneMatch.indexOf(etag) || '*' == noneMatch[0];
        }
        // if-modified-since
        if (modifiedSince) {
            modifiedSince = Date.parse(modifiedSince);
            lastModified = Date.parse(lastModified);
            notModified = lastModified <= modifiedSince;
        }

        return !!(etagMatches && notModified);
    }
870734
function isSupportedCached(feature, browsers) {
  const key = JSON.stringify({ feature, browsers });
  let result = isSupportedCache[key];

  if (!result) {
    result = isSupported(feature, browsers);
    isSupportedCache[key] = result;
  }

  return result;
}
1026623
function cacheQuery () {
    // debug
    debug('id:get', this.idCacheKeys, this.ids)
    // attempt to get from cache
    return this.cache.redis.mgetAsync(this.idCacheKeys)
    // check result
    .then(cached => {
        // list of ids that where not cached
        this.uncachedIds = []
        // check result set for uncached ids
        for (var i=0; i < this.numIds; i++) {
            var cachedValue = undefined
            // decode result if not null
            if (cached[i] !== null) {
                try {
                    // decode JSON
                    cachedValue = JSON.parse(cached[i])
                    // add cached flag
                    cachedValue._cached = true
                }
                catch (err) {
                    // ignore errors
                }
            }
            // if there is cached value use otherwise add id to fetch list
            defined(cachedValue)
                ? this.cached.push(cachedValue)
                : this.uncachedIds.push(this.ids[i])
        }
        // debug
        debug('id:uncachedIds', this.uncachedIds)
        // if all records were cached the return result from cache
        return this.uncachedIds.length === 0
            ? this.cached
            : this.loadUncached()
    })
}
381708
public void restore(HttpServletRequest req, HttpServletResponse res, boolean anyMethod) {
		if (!(req instanceof IExtendedRequest)) {
			if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
				Tr.debug(tc, "It is not an IExtendedRequest object");
			}
			return;
		}
		if (!anyMethod && !req.getMethod().equalsIgnoreCase("GET")) {
			return;
		}

		String reqURL = req.getRequestURI();
		IExtendedRequest extRequest = (IExtendedRequest) req;
		if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
			Tr.debug(tc, " method : " + req.getMethod() + " URL:" + reqURL);
		}
		String postParamSaveMethod = webAppSecurityConfig.getPostParamSaveMethod();
		if (postParamSaveMethod.equalsIgnoreCase(WebAppSecurityConfig.POST_PARAM_SAVE_TO_COOKIE)) {
			restoreFromCookie(extRequest, res, reqURL);
		} else if (postParamSaveMethod.equalsIgnoreCase(WebAppSecurityConfig.POST_PARAM_SAVE_TO_SESSION)) {
			restoreFromSession(extRequest, req, reqURL);
		}
	}
1043811
function shouldCompress (req, res) {
  var type = res.getHeader('Content-Type')

  if (type === undefined || !compressible(type)) {
    debug('%s not compressible', type)
    return false
  }

  return true
}
656649
function isLoadNeeded(newProps, oldProps) {
        return newProps.image.id !== oldProps.image.id || newProps.thumbnail !== oldProps.thumbnail;
      }
110283
function makeRequest(title, cacheHitExpected, next) {
  var start = Date.now();

  request({
    url: 'http://localhost:1337/'
  }, function(err, data, body) {
    var time = Date.now() - start;

    console.log(title);
    console.log('  status:', data.statusCode);
    console.log('  body  :', body);
    console.log('  time  :', time);

    common.verify(function() {
      common.shouldUseCache(cacheHitExpected, time);
    });

    console.log();

    next();
  });
}
1083450
function (req, res, err) {
    if (isResHeaderSent(res)) { //request has already been closed
        //console.log('cannot throw error on an already closed request')
        return;
    }
    if (typeof (err.stack) == 'string') {
        err.stack = err.stack.split(' at '); //stack string to array
    }
    var isHtml = new reqres(res, req).isHtml();
    if (isHtml) {
        ack.router().htmlCloseError({ debug: isProductionMode })(err, req, res);
    }
    else {
        ack.router().jsonCloseError({ debug: isProductionMode })(err, req, res);
    }
    resMarkClosed(res);
}