WL#1216: Query cache: Delayed invalidation

Affects: Server-7.1   —   Status: Un-Assigned

Currently we have query cache which does not change semantics, which is great,
however this makes it not usable in the cases where tables are updated very often.

Such applications often are OK to show updates to user with a bit of delay,
assuming it brings more performance. Furthermore such functionality would be 
very usable inside of "MySQL Proxy", allowing it to cache some queries.

Where are two approaches, both of them are usable in different cases:

1) SELECT query which is allowed to return outdated data:
   SELECT QCACHE_TIMEOUT=60 * FROM tbl;

   In this case we hold the query in the query cache for 60 seconds
   after it was invalidated.   This is the most simple to use as it works
   with any type of updates.


2) Delayed query cache invalidation.
   UPDATE QCACHE_REFRESH=60 popularity=popularity+1 where message_id=12345;

   Any type of update queries might be set to invalidate query cache with some
   delay. This is wery useful for "not important" updates, allowing you to 
   have some updates affecting content at onces, while others with delay.
   Good example could be forum - you want added message to be seen immediately,
   while message read scores do not need to be accurate.


It would be good to have both features implemented.