clear-cache.asciidoc 2.0 KB

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