Mysql invalidating query
As with content caching, it is most effective in read-heavy scenarios.
The My SQL query cache in particular should not be relied upon for performance as it is easy to invalidate large segments of the cache with minor changes to data.
The My SQL query cache is a global one shared among the sessions.
The Query Caching is one of the caching mechanism used to improve performance.
This strategy is very flexible, in that it allows the mutation code to decide on a case-by-case basis which queries should be invalidated based on both the previous query result and the result of the mutation.
(Alternatively, you could overload the existing update Queries to handle this by returning a special sentinel value instead of an updated query result.) The effect of invalidating a query removes the query results from the cache but does not immediately cause a refetch.
The two “2” The other value we can set for this directive is “2”.
If we set the value as “2”, it means that cache results only for queries that begin with SELECT SQL_CACHE.