]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Lock/ILockDriver.php
coding standards
[friendica.git] / src / Core / Lock / ILockDriver.php
index b066361be6ad20d081e7bd307433408939e5fe8d..a255f683454753e414e2c20677f106661dccf486 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 namespace Friendica\Core\Lock;
+use Friendica\Core\Cache;
 
 /**
  * Lock Driver Interface
@@ -10,29 +11,38 @@ namespace Friendica\Core\Lock;
 interface ILockDriver
 {
        /**
+        * Checks, if a key is currently locked to a or my process
         *
-        * @brief Acquires a lock for a given name
+        * @param string $key           The name of the lock
+        * @return bool
+        */
+       public function isLocked($key);
+
+       /**
+        *
+        * Acquires a lock for a given name
         *
         * @param string  $key      The Name of the lock
         * @param integer $timeout  Seconds until we give up
+        * @param integer $ttl      Seconds The lock lifespan, must be one of the Cache constants
         *
         * @return boolean Was the lock successful?
         */
-       public function acquireLock($key, $timeout = 120);
+       public function acquireLock($key, $timeout = 120, $ttl = Cache::FIVE_MINUTES);
 
        /**
-        * @brief Releases a lock if it was set by us
+        * Releases a lock if it was set by us
         *
-        * @param string $key Name of the lock
+        * @param string $key The Name of the lock
         *
-        * @return mixed
+        * @return void
         */
        public function releaseLock($key);
 
        /**
-        * @brief Releases all lock that were set by us
+        * Releases all lock that were set by us
         *
         * @return void
         */
        public function releaseAll();
-}
\ No newline at end of file
+}