PHPCon Poland 2024


(PECL wincache >= 1.1.0)

wincache_unlock Releases an exclusive lock on a given key


wincache_unlock(string $key): bool

Releases an exclusive lock that was obtained on a given key by using wincache_lock(). If any other process was blocked waiting for the lock on this key, that process will be able to obtain the lock.


Using of the wincache_lock() and wincache_unlock() can cause deadlocks when executing PHP scripts in a multi-process environment like FastCGI. Do not use these functions unless you are absolutely sure you need to use them. For the majority of the operations on the user cache it is not necessary to use these functions.



Name of the key in the cache to release the lock on.


Gibt bei Erfolg true zurück. Bei einem Fehler wird false zurückgegeben.


Beispiel #1 Using wincache_unlock()

= fopen("/tmp/lock.txt", "r+");
if (
wincache_lock(“lock_txt_lock”)) { // do an exclusive lock
ftruncate($fp, 0); // truncate file
fwrite($fp, "Write something here\n");
wincache_unlock(“lock_txt_lock”); // release the lock
} else {
"Couldn't get the lock!";

Siehe auch

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top