Caching and freshness
Date filters and cache age are separate controls.
freshness,date_fromanddate_tofilter which results come back, by publish date.max_ageandno_cacheset how old our stored copy of a result page or web page may be.
Cache classes
A search result is stored under its normalised input (the query, type, country, language, location, filters, page, num and safe). Each query gets a class from its intent, with a default maximum age.
| Class | Typical queries | Default max_age |
|---|---|---|
live | type: news, freshness: day, prices, scores | 10 minutes |
general | most web queries | 6 hours |
evergreen | definitions, reference, scholar, patents, geocoding | 7 days |
Pages read by fetch, content, extract and jobs are kept in a page store, by default for 24 hours for fetch, and by the class of their search for content.
Asking for a fresh copy
| Parameter | Effect |
|---|---|
max_age (seconds) | Use a stored copy only if it is at most this old, otherwise read fresh. Values above the class default are allowed up to 30 days. |
no_cache: true | Read fresh and never use a stored copy. The fresh copy is stored for later calls. |
Neither changes the price. A call with max_age: 0 or no_cache: true can take longer.
What the response says
| Field | Meaning |
|---|---|
cache.hit | true when the response, or every page in it, came from a stored copy. |
cache.data_age_seconds | Age of the oldest part of the response. 0 when everything was read for this call. |
cache.fetched_at | Unix seconds when the oldest part was read. |
Each content object and each fetch page has its own fetched_at. The header X-Web-Cache repeats hit or miss.