2018-06-26 16:31:04 -04:00
|
|
|
<?php
|
|
|
|
|
2018-06-26 17:28:07 -04:00
|
|
|
namespace Friendica\Util\Lock;
|
2018-06-26 16:31:04 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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();
|
2018-06-26 17:44:30 -04:00
|
|
|
}
|