Comments (11)
could be done in the .htaccess or via setting the header in the PHP file.
e.g. https://www.askapache.com/hacking/speed-site-caching-cache-control/
from delphi-epidata.
Just added that to #171. It should also improve responsiveness when switching back and forth between signals on the map.
from delphi-epidata.
I wasn't able to enable caching yet; I think ExpiresByType
requires AllowOverride
to be set in the Apache config. Someone needs to look into what settings are required and test them out on staging.
from delphi-epidata.
what is the status here? if you don't have access to the webserver setting the value via PHP would be an option as in
header('Cache-Control: public, max-age=86400');
or so
from delphi-epidata.
I think that's feasible. To do it through Apache would require coordinating some configuration changes with Brian, testing those on staging, and so on, but header()
is much easier.
I guess the question is how long we'd like to cache responses. Probably no more than a few hours, since signals update daily and someone who comes just before the update shouldn't have to wait 24 hours to get it?
from delphi-epidata.
you roughly know when you put in new data each day. So you could just set the Expires
header to that date: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expires
from delphi-epidata.
Each signal pipeline delivers data on a different schedule, though, so we'd have to build that into the code -- some kind of configuration file specifying expected delivery times for each pipeline. And then we'd have to think about what happens when a pipeline is late and how the headers should work.
I think a simple first pass would just use a default short expiry, and we can go from there.
from delphi-epidata.
from delphi-epidata.
There's probably a way to do this in Flask, but it looks like we don't yet? Here's what I get:
$ curl -sLI "https://api.covidcast.cmu.edu/epidata/covidcast/?signal=jhu-csse:confirmed-incidence-num&geo_type=nation&geo_value=us&time_type=day&time_value=20230101"
HTTP/2 200
date: Thu, 02 Feb 2023 18:26:48 GMT
content-type: application/json
content-length: 92
set-cookie: AWSALBTG=qacugPKQMWrsVqjUA8+5ECCJYZAGov2eBXdEFfLrsS9tVe74n2H2gu0UVvp6MX9YTUWz+707UXh6v4txX4efQ5yh/OvgOTaq51vKy0QHVoY+7qoVjk2BhVXpsdJaDody+4ay5bZgxS/L+U98Iha0RtGISny+LDZhpKMObub+2TnVTu+B8H8=; Expires=Thu, 09 Feb 2023 18:26:47 GMT; Path=/
set-cookie: AWSALBTGCORS=qacugPKQMWrsVqjUA8+5ECCJYZAGov2eBXdEFfLrsS9tVe74n2H2gu0UVvp6MX9YTUWz+707UXh6v4txX4efQ5yh/OvgOTaq51vKy0QHVoY+7qoVjk2BhVXpsdJaDody+4ay5bZgxS/L+U98Iha0RtGISny+LDZhpKMObub+2TnVTu+B8H8=; Expires=Thu, 09 Feb 2023 18:26:47 GMT; Path=/; SameSite=None; Secure
server: nginx/1.22.1
vary: Accept-Encoding
access-control-allow-origin: *
access-control-allow-methods: GET, POST, OPTIONS
access-control-allow-headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range
access-control-expose-headers: Content-Length,Content-Range
ie we say it's okay for a request to include a Cache-Control header but we don't send one in the response.
from delphi-epidata.
related: caching headers for metadata
from delphi-epidata.
related: discussion of caching options and pros/cons thereof
from delphi-epidata.
Related Issues (20)
- KCDC data is old (Oct 2020) HOT 1
- Inspect HHS dataset for revision inconsistencies and produce patches HOT 2
- Mention NHSN in `covid_hosp*` and `covidcast` `hhs` docs
- Update database drivers HOT 2
- Error when API request is made for an invalid region? HOT 1
- Replace misleading numeric values in `covid_hosp_facility`? HOT 2
- `covid_hosp_state_timeseries` doesn't return any data HOT 3
- `covid_hosp_facility` has entries with malformed `collection_week` dates HOT 1
- covid_hosp_facility data from Aug 7, 2023 is corrupted HOT 1
- fix uncaught user input processing in date util HOT 2
- Update deprecated github actions HOT 1
- Consider deprecation/removal of delphi_epidata.R client HOT 1
- "Date of last change" dates for some COVIDcast-signals pages should actively link to changelog HOT 1
- Missing from the Changelog's sources and signals is google-symptoms
- Move DB driver specification out of config and into code
- Log "Referer" header to help track tool usage HOT 1
- Some NY data missing from `fluview`
- Synchronize dependency versioning on automation servers HOT 1
- Document `covid_naat_pct_positive_7dav` in `dsew-cpr`
- API queries timing out at 1 min in the proxy HOT 11
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 delphi-epidata.