8.10.3.1 How the Query Cache Operates

Incoming queries are compared to those in the query cache
before parsing, so the following two queries are regarded as
different by the query cache:

SELECT * FROM tbl_name
Select * from tbl_name

Queries must be exactly the same (byte
for byte) to be seen as identical. In addition, query strings
that are identical may be treated as different for other
reasons. Queries that use different databases, different
protocol versions, or different default character sets are
considered different queries and are cached separately.

The cache is not used for queries of the following types:

Queries that are a subquery of an outer query

Queries executed within the body of a stored function,
trigger, or event

Before a query result is fetched from the query cache, MySQL
checks whether the user has
SELECT privilege for all
databases and tables involved. If this is not the case, the
cached result is not used.

The query cache works for SELECT SQL_CALC_FOUND_ROWS
... queries and stores a value that is returned by a
following SELECT FOUND_ROWS() query.
FOUND_ROWS() returns the
correct value even if the preceding query was fetched from the
cache because the number of found rows is also stored in the
cache. The SELECT FOUND_ROWS() query itself
cannot be cached.