diff options
author | Richard Steinmetz <richard@steinmetz.cloud> | 2025-04-11 09:18:23 +0200 |
---|---|---|
committer | Richard Steinmetz <richard@steinmetz.cloud> | 2025-04-11 09:19:18 +0200 |
commit | d6916eb5672320b44ffd53ffae61f68bdea3bcb8 (patch) | |
tree | 738699333ff8e6cd5603737f4050dfd3862e036e | |
parent | 345167ff182a32cab2915070da19db6a5ed2ba96 (diff) | |
download | nextcloud-server-fix/ldap/cache-ttl-jitter.tar.gz nextcloud-server-fix/ldap/cache-ttl-jitter.zip |
fix(ldap): add random jitter to cache ttlfix/ldap/cache-ttl-jitter
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
-rw-r--r-- | apps/user_ldap/lib/Connection.php | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php index 78a5f93d29e..1cf7f520a78 100644 --- a/apps/user_ldap/lib/Connection.php +++ b/apps/user_ldap/lib/Connection.php @@ -311,6 +311,9 @@ class Connection extends LDAPUtility { $key = $this->getCacheKey($key); $value = base64_encode(json_encode($value)); $ttl = $ttlOverride ?? $this->configuration->ldapCacheTTL; + // TODO: make jitter configurable (or disable)? + $ttlJitter = 0.1; + $ttl = random_int($ttl * (1 - $ttlJitter), $ttl * (1 + $ttlJitter)); $this->cache->set($key, $value, $ttl); } |