cacheService.js
function writeToVolatileCaches(currentCacheIndex, key, value){
    if(currentCacheIndex > 0){
      var curExpiration = self.caches[currentCacheIndex].expiration;
      for(var tempIndex = currentCacheIndex; tempIndex > -1; tempIndex--){
        var preExpiration = self.caches[tempIndex].expiration;
        if(preExpiration <= curExpiration){
          var preCache = self.caches[currentCacheIndex];
          if(value){
            preCache.set(key, value); /*This means that a more volatile cache can have a key longer than a less volatile cache. Should I adjust this?*/
          }
          else if(typeof key === 'object'){
            preCache.mset(key);
          }
        }
      }
    }
  }
function writeToVolatileCaches(currentCacheIndex, key, value){
    if(currentCacheIndex > 0){
      var curExpiration = self.caches[currentCacheIndex].expiration;
      for(var tempIndex = currentCacheIndex; tempIndex > -1; tempIndex--){
        var preExpiration = self.caches[tempIndex].expiration;
        if(preExpiration <= curExpiration){
          var preCache = self.caches[currentCacheIndex];
          if(value){
            preCache.set(key, value); /*This means that a more volatile cache can have a key longer than a less volatile cache. Should I adjust this?*/
          }
          else if(typeof key === 'object'){
            preCache.mset(key);
          }
        }
      }
    }
  }
function writeToVolatileCaches ( currentCacheIndex , key , value ) { if ( currentCacheIndex > 0 ) { var curExpiration = self . caches [ currentCacheIndex ] . expiration ; for ( var tempIndex = currentCacheIndex ; tempIndex > - 1 ; tempIndex -- ) { var preExpiration = self . caches [ tempIndex ] . expiration ; if ( preExpiration <= curExpiration ) { var preCache = self . caches [ currentCacheIndex ] ; if ( value ) { preCache . set ( key , value ) ; /*This means that a more volatile cache can have a key longer than a less volatile cache. Should I adjust this?*/ } else if ( typeof key === 'object' ) { preCache . mset ( key ) ; } } } } }
Writes data to caches that appear before the current cache in caches
@param {integer} currentCacheIndex
@param {string} key
@param {null | object | string} value
Writes data to caches that appear before the current cache in caches