import Storage from "./../Storage";
function setCache(key, value) {
  var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
    _ref$persist = _ref.persist,
    persist = _ref$persist === void 0 ? false : _ref$persist;
  if (value === undefined || value === null || value === '') {
    if (persist === 'session') Storage.removeSessionStorage(key);else if (persist) Storage.removeLocalStorage(key);
    delete window[key];
  } else {
    if (persist === 'session') Storage.setSessionStorage(key, value);else if (persist) Storage.setLocalStorage(key, value);
    window[key] = value;
  }
}
export default setCache;