]> git.ipfire.org Git - ipfire.org.git/commitdiff
accounts: Don't cache LDAP attributes
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 28 Jun 2023 12:08:47 +0000 (12:08 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 28 Jun 2023 12:08:47 +0000 (12:08 +0000)
Our LDAP servers are fast enough that we don't need to do this.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/backend/accounts.py

index 74dea723f0a18b7fc4bf240dc84c6075fbfe084b..e43c76d5f14dda2c239f3f964c2cb3be1d235549 100644 (file)
@@ -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