LDAP users take too long to show on user list


I’m writing this app: https://gitlab.com/eita/ldapusermanagement, which allows admins to create users on the LDAP backend using the NC interface. Using the addUser hook, the app creates an ldap user and deletes the NC user.

Right after I create new user, it shows correctly the user list. However, after a reload, the new user disappear and takes a long time (5 minutes) to start showing on NC users list. If I manually clear the redis cache, they show immediately.

I’m using NC12 connected on an openldapserver. I’m using the following cache configuration:

  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'filelocking.enabled' => 'true',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
    array (
      'host' => '/var/run/redis/redis.sock',
      'port' => 0,
      'timeout' => 0.0,

Is there any configuration on user_ldap or redis to solve this?

Is there a way of forcing the user cache to clear right after the user creation?


How caching works in the LDAP Backend: https://docs.nextcloud.com/server/11/admin_manual/configuration_user/user_auth_ldap.html#caching

And the LDAPPRovider has a clear cache method: https://github.com/nextcloud/server/blob/master/lib/public/LDAP/ILDAPProvider.php#L104

1 Like