aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/ICacheFactory.php
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2023-10-11 13:29:21 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2023-10-11 13:37:22 +0200
commitff672b11e2e9628fd721b097e6712f99cb9883f8 (patch)
treed744ed2ff6fdc453090b61c04b1efd9da4d8c153 /lib/public/ICacheFactory.php
parent04db454e9fc57483595e90dee348904acd4315ca (diff)
downloadnextcloud-server-ff672b11e2e9628fd721b097e6712f99cb9883f8.tar.gz
nextcloud-server-ff672b11e2e9628fd721b097e6712f99cb9883f8.zip
feat: Add factory method for in-memory caches
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/public/ICacheFactory.php')
-rw-r--r--lib/public/ICacheFactory.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/public/ICacheFactory.php b/lib/public/ICacheFactory.php
index d70a836aa52..70ad955849d 100644
--- a/lib/public/ICacheFactory.php
+++ b/lib/public/ICacheFactory.php
@@ -75,4 +75,20 @@ interface ICacheFactory {
* @since 13.0.0
*/
public function createLocal(string $prefix = ''): ICache;
+
+ /**
+ * Create an in-memory cache instance
+ *
+ * Useful for remembering values inside one process. Cache memory is cleared
+ * when the object is garbage-collected. Implementation may also expire keys
+ * earlier when the TTL is reached or too much memory is consumed.
+ *
+ * Cache keys are local to the cache object. When building two in-memory
+ * caches, there is no data exchange between the instances.
+ *
+ * @param int $capacity maximum number of cache keys
+ * @return ICache
+ * @since 28.0.0
+ */
+ public function createInMemory(int $capacity = 512): ICache;
}