1
0
Fork 0

Lock abstraction (like the Cache)

- adding interface
- adding seperate drivers
- moving Lock to the Core package
This commit is contained in:
Philipp Holzer 2018-06-26 22:31:04 +02:00
commit 0218d16335
No known key found for this signature in database
GPG key ID: 58160D7D6AF942B6
8 changed files with 396 additions and 223 deletions

View file

@ -0,0 +1,38 @@
<?php
namespace Friendica\Core\Lock;
/**
* Lock Driver Interface
*
* @author Philipp Holzer <admin@philipp.info>
*/
interface ILockDriver
{
/**
*
* @brief Acquires a lock for a given name
*
* @param string $key The Name of the lock
* @param integer $timeout Seconds until we give up
*
* @return boolean Was the lock successful?
*/
public function acquireLock($key, $timeout = 120);
/**
* @brief Releases a lock if it was set by us
*
* @param string $key Name of the lock
*
* @return mixed
*/
public function releaseLock($key);
/**
* @brief Releases all lock that were set by us
*
* @return void
*/
public function releaseAll();
}