veffect
Version:
powerful TypeScript validation library built on the robust foundation of Effect combining exceptional type safety, high performance, and developer experience. Taking inspiration from Effect's functional principles, VEffect delivers a balanced approach tha
107 lines (106 loc) • 3.97 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.makeWithTTLBy = exports.makeWithTTL = exports.makeWith = exports.make = exports.invalidate = exports.get = exports.KeyedPoolTypeId = void 0;
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("./internal/keyedPool.js"));
function _getRequireWildcardCache(e) {
if ("function" != typeof WeakMap) return null;
var r = new WeakMap(),
t = new WeakMap();
return (_getRequireWildcardCache = function (e) {
return e ? t : r;
})(e);
}
function _interopRequireWildcard(e, r) {
if (!r && e && e.__esModule) return e;
if (null === e || "object" != typeof e && "function" != typeof e) return {
default: e
};
var t = _getRequireWildcardCache(r);
if (t && t.has(e)) return t.get(e);
var n = {
__proto__: null
},
a = Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
}
return n.default = e, t && t.set(e, n), n;
}
/**
* @since 2.0.0
* @category symbols
*/
const KeyedPoolTypeId = exports.KeyedPoolTypeId = internal.KeyedPoolTypeId;
/**
* Makes a new pool of the specified fixed size. The pool is returned in a
* `Scope`, which governs the lifetime of the pool. When the pool is shutdown
* because the `Scope` is closed, the individual items allocated by the pool
* will be released in some unspecified order.
*
* @since 2.0.0
* @category constructors
*/
const make = exports.make = internal.make;
/**
* Makes a new pool of the specified fixed size. The pool is returned in a
* `Scope`, which governs the lifetime of the pool. When the pool is shutdown
* because the `Scope` is closed, the individual items allocated by the pool
* will be released in some unspecified order.
*
* The size of the underlying pools can be configured per key.
*
* @since 2.0.0
* @category constructors
*/
const makeWith = exports.makeWith = internal.makeWith;
/**
* Makes a new pool with the specified minimum and maximum sizes and time to
* live before a pool whose excess items are not being used will be shrunk
* down to the minimum size. The pool is returned in a `Scope`, which governs
* the lifetime of the pool. When the pool is shutdown because the `Scope` is
* used, the individual items allocated by the pool will be released in some
* unspecified order.
*
* The size of the underlying pools can be configured per key.
*
* @since 2.0.0
* @category constructors
*/
const makeWithTTL = exports.makeWithTTL = internal.makeWithTTL;
/**
* Makes a new pool with the specified minimum and maximum sizes and time to
* live before a pool whose excess items are not being used will be shrunk
* down to the minimum size. The pool is returned in a `Scope`, which governs
* the lifetime of the pool. When the pool is shutdown because the `Scope` is
* used, the individual items allocated by the pool will be released in some
* unspecified order.
*
* The size of the underlying pools can be configured per key.
*
* @since 2.0.0
* @category constructors
*/
const makeWithTTLBy = exports.makeWithTTLBy = internal.makeWithTTLBy;
/**
* Retrieves an item from the pool belonging to the given key in a scoped
* effect. Note that if acquisition fails, then the returned effect will fail
* for that same reason. Retrying a failed acquisition attempt will repeat the
* acquisition attempt.
*
* @since 2.0.0
* @category combinators
*/
const get = exports.get = internal.get;
/**
* Invalidates the specified item. This will cause the pool to eventually
* reallocate the item, although this reallocation may occur lazily rather
* than eagerly.
*
* @since 2.0.0
* @category combinators
*/
const invalidate = exports.invalidate = internal.invalidate;
//# sourceMappingURL=KeyedPool.js.map