[TYPO3-core] Caches and Locking
Philipp Gampe
philipp.gampe at typo3.org
Sun Mar 9 14:59:55 CET 2014
Hi Markus,
Markus Klein wrote:
> Just found something on the web too:
>
http://technical.allofe.com/contentm/easy_pages/easy_page_view.php?sid=62&page_id=246&blueprint_id=108
OK, point taken. Effectively only the operating system can assure your save,
concurrency-free locking.
We can just try to give our users the most sane options (flock, semaphore)
at hand that work most of the time and try to handle failures as gracefully
as possible.
BTW, you can solve the unlink problem by deleting by file id (e.g. file
index on windows, inode on most UNIX filesystems). A new file will get a new
id, although there are chances to get the old ID for the new file.
As always, it is just a workaround unless the OS is involved and gives you
assurance.
Another more failsafe* method would be to close the file, wait a bit and
open and read it again. This would be slow, but is a very accurate* poor-man
lock.
Oh, btw any locking will fail if you need to do it across multiple servers
unless you use special libraries.
* assuming an OS with semi-fair scheduling at normal operation
Best regards
--
Philipp Gampe – PGP-Key 0AD96065 – TYPO3 UG Bonn/Köln
Documentation – Active contributor TYPO3 CMS
TYPO3 .... inspiring people to share!
More information about the TYPO3-team-core
mailing list