UNPKG

@nasriya/cachify

Version:

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

25 lines (24 loc) 861 B
import atomix from "@nasriya/atomix"; class PersistanceService { #_service; #_configs; constructor(service, configs) { const clone = atomix.dataTypes.object.smartClone.bind(atomix.dataTypes.object); const deepFreeze = atomix.dataTypes.record.deepFreeze.bind(atomix.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; } } export default PersistanceService;