import { Cache } from "cache-manager";
import { CacheableConfiguration } from "./cacheable.interfaces";
export let cache: Cache;
export let cacheConfigOption: CacheableConfiguration = {
  ttl: 1000 * 60,
};
export const setCacheManager = (c: Cache) => {
  cache = c;
};
export const getCacheManager = (): Cache => {
  return cache;
};
export const setCacheConfiguration = (c: CacheableConfiguration) => {
  if (c.refreshThreshold) {
    cacheConfigOption.refreshThreshold = c.refreshThreshold;
  }
  if (c.ttl) {
    cacheConfigOption.ttl = c.ttl;
  }
  if (c.isDev) {
    cacheConfigOption.isDev = c.isDev;
  }
};
