JoeGandy / ShareX-Custom-Upload

A little PHP script created for uploading custom sharex files to your own webserver
MIT License
166 stars 50 forks source link

Add caching with ETag validation #102

Closed theaquarium closed 4 years ago

theaquarium commented 4 years ago

Resolves #100

This implements caching for images and includes validation using image hashes and the ETag header.

Thanks to @davwheat for the code.

JoeGandy commented 4 years ago

Whats the reason for someone not wanting image caching? just figuring out if adding a optional config is useful or not :)

davwheat commented 4 years ago

@JoeGandy Honestly, I can't think of one. The ETag handles if they change the file, or delete it.

I guess it's just better have to more configuration than less. Having an option won't hurt, but it should be on by default.

theaquarium commented 4 years ago

The only thing I thought could be a problem is if someone renames an image and then uploads something with a new name before their cache's TTL expires. The cache's TTL is currently set to 15 minutes, so the ETag won't do anything until 15 minutes after accessing the file, which could cause problems in certain situations. I think it's useful to just have a bunch of configuration options people can use if they need to.

theaquarium commented 4 years ago

I'll just leave the option since I think it's always good to have configuration.