function setCache(key: string, value: any) {
  window.localStorage.setItem(key, JSON.stringify(value));
}

function getCache(key: string) {
  const value = window.localStorage.getItem(key);
  if (value) {
    return JSON.parse(value);
  }
}

function removeCache(key: string) {
  window.localStorage.removeItem(key);
}

function clearCache() {
  window.localStorage.clear();
}

export { setCache, getCache, removeCache, clearCache };
