NineSec Team Shell
Server IP : 92.205.26.207  /  Your IP : 216.73.216.16
Web Server : Apache
System : Linux 207.26.205.92.host.secureserver.net 4.18.0-553.60.1.el8_10.x86_64 #1 SMP Thu Jul 10 04:01:16 EDT 2025 x86_64
User : zikryat ( 1002)
PHP Version : 8.3.23
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/zikryat/public_html/node_modules/@nestjs/common/cache/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/zikryat/public_html/node_modules/@nestjs/common/cache/cache.providers.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createCacheManager = void 0;
const load_package_util_1 = require("../utils/load-package.util");
const cache_constants_1 = require("./cache.constants");
const cache_module_definition_1 = require("./cache.module-definition");
const default_options_1 = require("./default-options");
/**
 * Creates a CacheManager Provider.
 *
 * @publicApi
 */
function createCacheManager() {
    return {
        provide: cache_constants_1.CACHE_MANAGER,
        useFactory: async (options) => {
            const cacheManager = (0, load_package_util_1.loadPackage)('cache-manager', 'CacheModule', () => require('cache-manager'));
            const cacheManagerIsv5OrGreater = 'memoryStore' in cacheManager;
            const cachingFactory = async (store, options) => {
                if (!cacheManagerIsv5OrGreater) {
                    return cacheManager.caching(Object.assign(Object.assign({}, default_options_1.defaultCacheOptions), Object.assign(Object.assign({}, options), { store })));
                }
                let cache = 'memory';
                default_options_1.defaultCacheOptions.ttl *= 1000;
                if (typeof store === 'object') {
                    if ('create' in store) {
                        cache = store.create;
                    }
                    else {
                        cache = store;
                    }
                }
                else if (typeof store === 'function') {
                    cache = store;
                }
                return cacheManager.caching(cache, Object.assign(Object.assign({}, default_options_1.defaultCacheOptions), options));
            };
            return Array.isArray(options)
                ? cacheManager.multiCaching(await Promise.all(options.map(option => cachingFactory(option.store, option))))
                : cachingFactory(options.store, options);
        },
        inject: [cache_module_definition_1.MODULE_OPTIONS_TOKEN],
    };
}
exports.createCacheManager = createCacheManager;

NineSec Team - 2022