From: Michael Tremer Date: Wed, 28 Jun 2023 12:08:47 +0000 (+0000) Subject: accounts: Don't cache LDAP attributes X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2d6fff58c38ae45c47d56a27f87d2fb9f3ab2769;p=ipfire.org.git accounts: Don't cache LDAP attributes Our LDAP servers are fast enough that we don't need to do this. Signed-off-by: Michael Tremer --- diff --git a/src/backend/accounts.py b/src/backend/accounts.py index 74dea723..e43c76d5 100644 --- a/src/backend/accounts.py +++ b/src/backend/accounts.py @@ -97,15 +97,6 @@ class LDAPObject(Object): # Run modify operation self.ldap.modify_s(self.dn, modlist) - # Clear cache - self._clear_cache() - - def _clear_cache(self): - """ - Clears cache - """ - pass - def _set(self, key, values): current = self._get(key) @@ -297,13 +288,7 @@ class Accounts(Object): return attrs def get_by_dn(self, dn): - attrs = self.memcache.get("accounts:%s:attrs" % dn) - if attrs is None: - attrs = self._get_attrs(dn) - assert attrs, dn - - # Cache all attributes for 5 min - self.memcache.set("accounts:%s:attrs" % dn, attrs, 300) + attrs = self._get_attrs(dn) return Account(self.backend, dn, attrs) @@ -704,10 +689,6 @@ class Account(LDAPObject): return NotImplemented - def _clear_cache(self): - # Delete cached attributes - self.memcache.delete("accounts:%s:attrs" % self.dn) - @property def kerberos_principal_dn(self): return "krbPrincipalName=%s@IPFIRE.ORG,cn=IPFIRE.ORG,cn=krb5,dc=ipfire,dc=org" % self.uid