INNER CODE UNIT · JavaScript

isCacheEnabled

furey/mongodb-lens · mongodb-lens.js:74

const isCacheEnabled = (cacheType) =>
  config.enabledCaches.includes(cacheType)

const getCachedValue = (cacheType, key) => {
  if (!isCacheEnabled(cacheType)) return null

  const cache = memoryCache[cacheType]
  const cachedData = cache.get(key)

  if (cachedData && (Date.now() - cachedData.timestamp) < config.cacheTTL[cacheType]) {
    log(`Using cached ${cacheType} for '${key}'`)
    return cachedData.data
  }

  return null
}

const setCachedValue = (cacheType, key, data) => {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…