@Override
    public int getUserCount() {
        // Cache user count for 5 minutes.
        if (userCount != -1 && allUserCacheExpires.isAfter(Instant.now())) {
            return userCount;
        }
        // Refresh the cache
        getUsers();
        return this.userCount;
    }
LDAP implementation of the UserProvider interface. All data in the directory is
treated as read-only so any set operations will result in an exception.

@author Matt Tucker
xmppserver/src/main/java/org/jivesoftware/openfire/ldap/LdapUserProvider.java