"use strict"
Object.defineProperty(exports, "__esModule", { value: true })
exports.cached_ = exports.cached = void 0
const cachedInvalidate_1 = require("./cachedInvalidate")
const map_1 = require("./map")
/**
 * Returns an effect that, if evaluated, will return the cached result of
 * this effect. Cached results will expire after `timeToLive` duration.
 *
 * @dataFirst cached_
 */
function cached(ttl, __trace) {
  return (fa) => cached_(fa, ttl)
}
exports.cached = cached
/**
 * Returns an effect that, if evaluated, will return the cached result of
 * this effect. Cached results will expire after `timeToLive` duration.
 */
function cached_(fa, ttl, __trace) {
  return (0, map_1.map_)(
    (0, cachedInvalidate_1.cachedInvalidate_)(fa, ttl, __trace),
    ({ tuple: [cachedEffect, _] }) => cachedEffect
  )
}
exports.cached_ = cached_
//# sourceMappingURL=cached.js.map
