UNPKG

@nasriya/cachify

Version:

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

56 lines (55 loc) 1.84 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Cachify = void 0; const client_1 = __importDefault(require("./client")); class Cachify extends client_1.default { /** * Retrieves the current debug mode status for the cache system. * * @returns {boolean} `true` if the debug mode is enabled, `false` otherwise. * @since v1.0.0 */ get debug() { return process.env.CACHIFY_DEBUG === 'true'; } /** * Sets the debug mode for the cache system. * * If the value is `true`, the cache system will log additional information about its operations. * If the value is `false`, the cache system will not log any additional information. * * @param {boolean} value - The value to set the debug mode to. * @throws {TypeError} Throws if the provided value is not a boolean. * @since v1.0.0 */ set debug(value) { if (typeof value !== 'boolean') { throw new TypeError('The provided value must be a boolean.'); } process.env.CACHIFY_DEBUG = value ? 'true' : 'false'; } /** * Creates a new instance of the CachifyClient class. * * @returns {CachifyClient} A new instance of the CachifyClient class. * @since v1.0.0 */ createClient() { return Cachify.createClient(); } /** * Creates a new instance of the CachifyClient class. * * @returns {CachifyClient} A new instance of the CachifyClient class. * @since v1.0.0 */ static createClient() { return new client_1.default(); } } exports.Cachify = Cachify; const cachify = new Cachify(); exports.default = cachify;