Comments (5)
Please, see #33.
That being said, I don't have a clear idea about the scope of the feature you want to cover here.
from imaginary.
I don't propose a caching layer in Imaginary. Rather only HTTP caching headers.
So, whenever I do something like:
> GET /crop?width=290&height=218&file=c76/6ba/cf/6a0cb5df&type=jpeg&quality=85 HTTP/1.1
> Host: imaginary.example.org
> User-Agent: curl/7.43.0
> Accept: */*
>
The reply would read:
< HTTP/1.1 200 OK
< Content-Type: image/jpeg
< Date: Fri, 30 Oct 2015 08:56:17 GMT
< Server: imaginary 0.1.14 (bimg 0.1.19)
< transfer-encoding: chunked
< Connection: keep-alive
< Cache-Control: public, max-age=31536000
< Expires: Wed, 26 Oct 2016 22:00:23 GMT
< Last-Modified: Fri, 28 Aug 2015 21:45:00 GMT
< Vary: Origin
Where the last 4 headers would be the significant part.
Now that I think about it, just specifying a static list of arbitrary headers would be sufficient. But I'm now thinking if this is something Imaginary should support or not. I see some other use-cases (like origin identification), but I'm not sure if that justifies this feature.
To illustrate even further, Imaginary could've been started like so:
docker run \
...
HTTP_CACHE_CONTROL=Cache-Control: public, max-age=31536000
HTTP_EXPIRES_TIMESTAMP=Wed, 26 Oct 2016 22:00:23 GMT
HTTP_LAST_MODIFIED_TIMESTAMP=Fri, 28 Aug 2015 21:45:00 GMT
HTTP_VARY=Origin
from imaginary.
I see now. In that case, this would be only valid when imaginary
relies on the file system to read the images, so we can use FileInfo to retrieve the Last-Modified header, for instance.
Then, I believe we can simplify the other headers just adding an additional option with the cache TTL.
I believe that this should be only supported if imaginary
is using the file system, otherwise is useless and a bit incongruent.
I would not mind supporting this feature if it's clean and simple to use, so feel free to go ahead with a PR.
from imaginary.
Excellent. I'm fairly inexperienced with Go, but feel free to lay it on me in the PR (-:
Before I'll start I'll make a small specification to make sure it's heading the way you want.
from imaginary.
Sounds great!
from imaginary.
Related Issues (20)
- stripmeta=true results in wrong colors for non-sRGB JPEGs
- Does Imaginary Docker support arm? Not compatible with Raspberry Pi 4 HOT 3
- Where can I find the log files?
- Error with throttled package HOT 4
- Resize PNG without antialiasing HOT 3
- How to debug error 400 ? HOT 3
- Is there any option to crop at position?
- Integrate pull request preview environments
- Imaginary preview generation failed: HOT 1
- What causes the "Image Resolution is too Big" Error? HOT 1
- New release HOT 8
- Is there a way to deskew an image?
- Passing Last-Modified or etag in response header
- 1 Is there any method to copy from savePath to "collect_${savePath}"? ; 2 Check whether there is a method to clear the vicinity by a specific directory or by a time range.
- Build image from Dockerfile error
- throttled.NewGCRARateLimiter is deprecated
- `-cpus <num>` doesnโt seem to set the number of cores HOT 1
- Is there a way to pass through Cache-control headers? HOT 1
- Adding support for response headers
- Docker keeps throwing (VMAllocationTracker.cpp:137 vm_allocation_info_for_address) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imaginary.