#25262add() method needed in caching framework
Description
Would be good to implement add() method in caching framework. Such method exists in memcached yet and I think could be implemented in DB backend too.
In memcached add() method stores variable with key only if such key doesn’t exist yet. add() returns FALSE if such key already exist.
This is vital for correct implementation of locking in cache – first client who acquire lock sets NULL by key in cache and next clients will wait until data is ready and NULL replaced with data. add() method is needed to make sure that only one client will acquire the lock. If add($key, NULL) returns FALSE then lock acquired yet.
I know that there is locking API in TYPO3, but IMHO locks being implemented directly in cache is better for the sake of caching – in such case we just read the cache for data and at once see if lock is set and no other API calls are needed.
Also in case of memcached it should work much faster than file based locking.
(issue imported from #M17874)
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.