Project

General

Profile

Actions

Feature #25262

closed

add() method needed in caching framework

Added by Vladimir Podkovanov about 13 years ago. Updated almost 11 years ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
Caching
Target version:
-
Start date:
2011-03-05
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

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)

Actions

Also available in: Atom PDF