this is a follow up of
If two processes were started at the same time and if they read the same expiry.php, the process which will be ended last will overwrite the changes of the earlier process.
User A is updating the user cache
User B is moving a tree
Both processes read the same expiry.
Process A writes the user-info-cache key
Process B writes the view cache key and the template block key
Process B is reverting the changes of Process A because the expiry.php isn't reloaded before it's written.
a) Reload the expiry.php before it's written
b) Only update the changed keys and only update the keys if they are older than the current one.
The first solution will be only reloading the expiry.php before it's written.
The longtime solution should be: Doing a "expiry.php" queue like the async. So, every update request should be written in a db table and a daemon is updating the expiry.php every x seconds - if there are changes.