clear-cache.asciidoc 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. [role="xpack"]
  2. [[security-api-clear-cache]]
  3. === Clear Cache API
  4. The Clear Cache API evicts users from the user cache. You can completely clear
  5. the cache or evict specific users.
  6. ==== Request
  7. `POST _xpack/security/realm/<realms>/_clear_cache` +
  8. `POST _xpack/security/realm/<realms>/_clear_cache?usernames=<usernames>`
  9. ==== Description
  10. User credentials are cached in memory on each node to avoid connecting to a
  11. remote authentication service or hitting the disk for every incoming request.
  12. There are realm settings that you can use to configure the user cache. For more
  13. information, see {xpack-ref}/controlling-user-cache.html[Controlling the User Cache].
  14. To evict roles from the role cache, see the
  15. <<security-api-clear-role-cache,Clear Roles Cache API>>.
  16. ==== Path Parameters
  17. `realms` (required)::
  18. (list) A comma-separated list of the realms to clear.
  19. `usernames`::
  20. (list) A comma-separated list of the users to clear from the cache. If you
  21. do not specify this parameter, the API evicts all users from the user cache.
  22. ==== Examples
  23. For example, to evict all users cached by the `file` realm:
  24. [source,js]
  25. --------------------------------------------------
  26. POST _xpack/security/realm/default_file/_clear_cache
  27. --------------------------------------------------
  28. // CONSOLE
  29. To evict selected users, specify the `usernames` parameter:
  30. [source,js]
  31. --------------------------------------------------
  32. POST _xpack/security/realm/default_file/_clear_cache?usernames=rdeniro,alpacino
  33. --------------------------------------------------
  34. // CONSOLE
  35. To clear the caches for multiple realms, specify the realms as a comma-delimited
  36. list:
  37. [source, js]
  38. ------------------------------------------------------------
  39. POST _xpack/security/realm/default_file,ldap1/_clear_cache
  40. ------------------------------------------------------------
  41. // CONSOLE