Server Cache By default, Keycloak caches realm metadata and users. There are two separate caches, one for realm metadata (realm, application, client, roles, etc...) and one for users. These caches greatly improves the performance of the server.
Eviction and Expiration By default the user cache contains a maximum of 10000 entries. This is not 10000 users, but 10000 entries in the cache. You can change the maximum number of entries by editing the server configuration standalone.xml or standalone-ha.xml. Locate the element cache-container name="keycloak" and change the eviction policy for the users cache. For more information see Infinispan Subsystem documentation.
Disabling Caches To disable the realm or user cache, you must edit the keycloak-server.json file in your distribution. Here's what the config looks like initially. To disable the cache set the enabled field to false for the cache you want to disable:
Clear Caches To clear the realm or user cache, go to the Keycloak admin console Realm Settings->Cache Config page. On this page you can clear the realm cache or the user cache. This will clear the caches for all realms and not only the selected realm.