]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Lock/ILock.php
Merge pull request #9039 from MrPetovan/task/frio-accent-scheme
[friendica.git] / src / Core / Lock / ILock.php
index 0b91daeb568d9bc808d3d907cef4a29e504e81af..4a54217a9d8132b0149f8132cefe6559887c9474 100644 (file)
@@ -1,13 +1,30 @@
 <?php
+/**
+ * @copyright Copyright (C) 2020, Friendica
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
 
 namespace Friendica\Core\Lock;
 
-use Friendica\Core\Cache;
+use Friendica\Core\Cache\Duration;
 
 /**
  * Lock Interface
- *
- * @author Philipp Holzer <admin@philipp.info>
  */
 interface ILock
 {
@@ -30,7 +47,7 @@ interface ILock
         *
         * @return boolean Was the lock successful?
         */
-       public function acquireLock($key, $timeout = 120, $ttl = Cache\Cache::FIVE_MINUTES);
+       public function acquire($key, $timeout = 120, $ttl = Duration::FIVE_MINUTES);
 
        /**
         * Releases a lock if it was set by us
@@ -40,12 +57,30 @@ interface ILock
         *
         * @return boolean Was the unlock successful?
         */
-       public function releaseLock($key, $override = false);
+       public function release($key, $override = false);
 
        /**
         * Releases all lock that were set by us
         *
+        * @param bool $override Override to release all locks
+        *
         * @return boolean Was the unlock of all locks successful?
         */
-       public function releaseAll();
+       public function releaseAll($override = false);
+
+       /**
+        * Returns the name of the current lock
+        *
+        * @return string
+        */
+       public function getName();
+
+       /**
+        * Lists all locks
+        *
+        * @param string prefix optional a prefix to search
+        *
+        * @return array Empty if it isn't supported by the cache driver
+        */
+       public function getLocks(string $prefix = '');
 }