Setting the TTL

The default invalidation strategy of the query cache plugin is Time-to-Live (
TTL). The built-in storage handler will use the default
TTL defined by the PHP configuration value
mysqlnd_qc.ttl unless the query string contains
a hint for setting a different
TTL. The
TTL is specified in seconds.

Any
TTL based cache can serve stale data. Cache entries
are not automatically invalidated, if underlying data changes.

User-defined cache storage handler can implement any invalidation strategy
to work around this limitation.

The default
TTL can be overruled using the SQL hint
/*qc_tt=seconds*/. The SQL hint must be appear immediately
after the SQL hint which enables caching. It is recommended to use
the PHP constant
MYSQLND_QC_TTL_SWITCH instead of using the string value.