- init (max: number) {
- this.lru = new asyncLRU({
- max,
- load: (key, cb) => {
- this.loadPreviews(key)
- .then(res => cb(null, res))
- .catch(err => cb(err))
- }
- })
-
- this.lru.on('evict', (obj: { key: string, value: string }) => {
- unlinkPromise(obj.value).then(() => logger.debug('%s evicted from VideosPreviewCache', obj.value))
- })
- }
-
- async getPreviewPath (key: string) {
- const video = await VideoModel.loadByUUID(key)