persist_for enables you to modify the amount of time that cached query results are used for a given Explore. The default cache length in Looker is 1 hour. Cache results are stored in an encrypted file on your Looker instance.
The caching mechanism in Looker works as follows: Once a user runs a specific query, the result of that query is cached. If precisely the same query (everything must be the same, including things such as the row limits, etc.) is run again, in less than the time period specified by persist_for, the cached results are returned. Otherwise, a new query is run against your database.
When the persist_for time expires, data is deleted from the cache, as long as the Instant Dashboards Looker Labs feature is disabled. See the Caching queries and rebuilding PDTs with datagroups documentation page for information on how long data is stored in the cache.
If persist_for is set for both an Explore and its model, the value set for the Explore will take priority for queries based on that Explore.
The persist_for (for Explores) documentation page details the following elements:
- Seeing whether a query was returned from cache
- Forcing new results to be generated from the database