src/internals/reactools/fetch/cache.js
/**
 * Set the response data to the cache store
 * @param {string} url - request url
 * @param {object} options - request options
 * @param {object} res - full response object with data, status code etc
 * @param {object} entry - corresponding metadata entry of the request
 */
Set the response data to the cache store
@param {string} url - request url
@param {object} options - request options
@param {object} res - full response object with data, status code etc
@param {object} entry - corresponding metadata entry of the request
Set the response data to the cache store @param { string } url - request url @param { object } options - request options @param { object } res - full response object with data status code etc @param { object } entry - corresponding metadata entry of the request
function updateCache(url, options, res, entry) {
  if (!rootCacheFlag) {
    return;
  }
  if (options.method.toLowerCase() !== 'get' && entry.cache !== true) {
    return;
  }
  if (entry.cache === false) {
    return;
  }
  cache[JSON.stringify({ url, options })] = res;
}
function updateCache ( url , options , res , entry ) { if ( ! rootCacheFlag ) { return ; } if ( options . method . toLowerCase ( ) !== 'get' && entry . cache !== true ) { return ; } if ( entry . cache === false ) { return ; } cache [ JSON . stringify ( { url , options } ) ] = res ; }
Set the response data to the cache store
 @param {string} url - request url
 @param {object} options - request options
 @param {object} res - full response object with data, status code etc
 @param {object} entry - corresponding metadata entry of the request
Set the response data to the cache store @param { string } url - request url @param { object } options - request options @param { object } res - full response object with data status code etc @param { object } entry - corresponding metadata entry of the request
// Users can disable caching for all request by providing that option while creating the fetch middleware/saga // If the request method is not GET, we don't cache by default // Users can force caching for such requests by setting the cache flag in corresponding metadata entry to true // For GET requests, users can disable caching by setting the cache flag to false. // Note: Not setting the flag(i.e undefined) will not prevent caching. // Cache data using url and options as the key