UNPKG

@nasriya/cachify

Version:

A lightweight, extensible in-memory caching library for storing anything, with built-in TTL and customizable cache types.

30 lines (29 loc) 1.14 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const atomix_1 = __importDefault(require("@nasriya/atomix")); class PersistanceService { #_service; #_configs; constructor(service, configs) { const clone = atomix_1.default.dataTypes.object.smartClone.bind(atomix_1.default.dataTypes.object); const deepFreeze = atomix_1.default.dataTypes.record.deepFreeze.bind(atomix_1.default.dataTypes.record); this.#_service = service; this.#_configs = deepFreeze(clone(configs)); } /** * Retrieves the type of storage service associated with this persistence service. * * @returns {S} The service type. */ get service() { return this.#_service; } /** * The configuration options for the persistence service, as set by the user when creating the service. * @readonly * @type {DeepReadonly<Configs<S>>} */ get configs() { return this.#_configs; } } exports.default = PersistanceService;