import localforage from "localforage";
import cleanObjectOfReferences from "./cleanObjectOfReferences";
export default async function setCache(key, value) {
  var _a;
  if (!value && value !== false)
    return value;
  try {
    await ((_a = localforage === null || localforage === void 0 ? void 0 : localforage.setItem) === null || _a === void 0 ? void 0 : _a.call(localforage, key, await cleanObjectOfReferences(value)));
  }
  catch (error) {
    console.log(key, value, "Error setting data from cache with localforage", error);
  }
  return value;
}
