feat/add-thumbnail-caching #3

Merged
hodlbod merged 1 commits from priyanshu_bharti/vthumbs:feat/add-thumbnail-caching into master 2026-04-14 17:21:10 +00:00
Contributor

Summary

Added in-memory caching to the /thumbnail endpoint so repeated requests for the same video URL do not re-run ffmpeg.

What changed

  • Added node-cache with a 1 hour TTL
  • Cached thumbnails by the url query parameter
  • On cache hit, returned the stored JPEG buffer directly
  • On cache miss, generated the thumbnail with ffmpeg and stored it in cache
  • Set the ffmpeg binary path using @ffmpeg-installer/ffmpeg
  • Kept the existing Content-Type and Cache-Control headers
  • Kept proper error handling

Verification

  • Confirmed /health returns 200 OK
  • Confirmed /thumbnail returns a JPEG response
  • Confirmed repeated requests for the same URL are served from cache

Notes

  • Changes are limited to the implementation files only

close #2

## Summary Added in-memory caching to the `/thumbnail` endpoint so repeated requests for the same video URL do not re-run `ffmpeg`. ## What changed - Added `node-cache` with a 1 hour TTL - Cached thumbnails by the `url` query parameter - On cache hit, returned the stored JPEG buffer directly - On cache miss, generated the thumbnail with `ffmpeg` and stored it in cache - Set the ffmpeg binary path using `@ffmpeg-installer/ffmpeg` - Kept the existing `Content-Type` and `Cache-Control` headers - Kept proper error handling ## Verification - Confirmed `/health` returns `200 OK` - Confirmed `/thumbnail` returns a JPEG response - Confirmed repeated requests for the same URL are served from cache ## Notes - Changes are limited to the implementation files only close #2
priyanshu_bharti added 1 commit 2026-04-14 17:19:38 +00:00
priyanshu_bharti force-pushed feat/add-thumbnail-caching from a0ec11f294 to 5457244d74 2026-04-14 17:19:38 +00:00 Compare
Owner

Perfect, thanks!

Perfect, thanks!
hodlbod merged commit 251e792263 into master 2026-04-14 17:21:10 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: coracle/vthumbs#3