Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP cache for thumbnails, pages, dimensions #214

Merged
merged 4 commits into from
Aug 17, 2021

Conversation

Leeingnyo
Copy link
Member

Use ETag header for HTTP caching

  • thumbnails and pages
  • dimensions
    • It took so long times for big manga files, since it requires to read an entire zip file. For the device that has a bad I/O performance, It would be helped.
    • I use a zip_path of an entry and its mtime for hashing (SHA1), set ETag for weak validation

Get image data and use it for hashing
Use zip_path and mtime for hashing
It used for weak validation
@Leeingnyo
Copy link
Member Author

Should I use browser cache, too?

Cache-Control: public, max-age=#{seconds}

the above response header makes images cached into a memory or a disk.
It make the browser skip a HTTP request for the images.
but I can't set a value of max-age for caching

@Leeingnyo Leeingnyo linked an issue Aug 16, 2021 that may be closed by this pull request
@hkalexling
Copy link
Member

Thanks a lot for the PR! I took a quick look and it looks good. Let me spend more time and test it tomorrow :)

@hkalexling
Copy link
Member

Regarding the max-age value, I think for the pages and dimensions we can be more aggressive and set it to something like 86400 seconds (which is 24 hours) or even higher. But for the thumbnail we should probably disable browser cache, because the user can upload a custom thumbnail whenever they want.

@Leeingnyo
Copy link
Member Author

okay! I'll add max-age header for pages and dimensions API

Copy link
Member

@hkalexling hkalexling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@hkalexling hkalexling merged commit 29923f6 into getmango:dev Aug 17, 2021
@Leeingnyo Leeingnyo deleted the feature/http-cache branch August 18, 2021 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] HTTP cache for thumbnails and pages
2 participants