index.js
function set (key, value, time = 60) {
  let expireTime
  const cacheKey = `${prefix}${key}`
  const expireKey = `${expire}${key}`

  if (typeof time === 'number') {
    expireTime = dateAdd(Date.now(), 'minute', time)
  } else if (time !== null && typeof time === 'object' && time.interval && time.units) {
    expireTime = dateAdd(Date.now(), time.interval, time.units)
  } else {
    throw new Error('Invalid time provided for set')
  }

  return storage.set(expireKey, expireTime).then(() => storage.set(cacheKey, value))
}
function set (key, value, time = 60) {
  let expireTime
  const cacheKey = `${prefix}${key}`
  const expireKey = `${expire}${key}`

  if (typeof time === 'number') {
    expireTime = dateAdd(Date.now(), 'minute', time)
  } else if (time !== null && typeof time === 'object' && time.interval && time.units) {
    expireTime = dateAdd(Date.now(), time.interval, time.units)
  } else {
    throw new Error('Invalid time provided for set')
  }

  return storage.set(expireKey, expireTime).then(() => storage.set(cacheKey, value))
}
function set ( key , value , time = 60 ) { let expireTime const cacheKey = ` ${ prefix } ${ key } ` const expireKey = ` ${ expire } ${ key } ` if ( typeof time === 'number' ) { expireTime = dateAdd ( Date . now ( ) , 'minute' , time ) } else if ( time !== null && typeof time === 'object' && time . interval && time . units ) { expireTime = dateAdd ( Date . now ( ) , time . interval , time . units ) } else { throw new Error ( 'Invalid time provided for set' ) } return storage . set ( expireKey , expireTime ) . then ( ( ) => storage . set ( cacheKey , value ) ) }
Persist value and expire date of cache.

@param {string} key
@param {Any} value Value to persist
@param {Number or Object} [time=60]  Time in minutes
@returns {Promise}
Persist value and expire date of cache .