Files
YouTube.js/src/utils/Cache.ts
2023-04-28 22:35:09 -03:00

21 lines
578 B
TypeScript

import type { ICache } from '../types/Cache.js';
import { Platform } from './Utils.js';
export default class UniversalCache implements ICache {
#cache: ICache;
constructor(persistent: boolean, persistent_directory?: string) {
this.#cache = new Platform.shim.Cache(persistent, persistent_directory);
}
get cache_dir() {
return this.#cache.cache_dir;
}
get(key: string) {
return this.#cache.get(key);
}
set(key: string, value: ArrayBuffer) {
return this.#cache.set(key, value);
}
remove(key: string) {
return this.#cache.remove(key);
}
}