import { Cache, TTL } from '../cache/Cache.js';
import { Service } from '../core/Service.js';
export default class CacheService extends Service {
    static key = 'api-service/cache';
    cache;
    get TTL() {
        return TTL;
    }
    constructor() {
        super();
        this.cache = new Cache();
    }
    getCache() {
        return this.cache;
    }
    /**
     * Store data in the cache with optional TTL
     *
     * @param key - The key to store the data under
     * @param data - The data to store
     * @param ttl - Time to live in milliseconds
     * @returns A promise that resolves to true if the data was stored successfully, false otherwise
     */
    async set(key, data, ttl) {
        return this.cache.set(key, data, ttl);
    }
    /**
     * Retrieve data from the cache with type safety
     */
    async get(key) {
        return this.cache.get(key);
    }
    /**
     * Delete a specific cache item
     */
    async delete(key) {
        return this.cache.delete(key);
    }
    async clear() {
        await this.cache.clear();
    }
    async destroy() {
        await this.cache.close();
        await super.destroy();
    }
}
//# sourceMappingURL=CacheService.js.map