clear-cache.asciidoc 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. <<controlling-user-cache>>.
  20. To evict roles from the role cache, see the
  21. <<security-api-clear-role-cache,Clear roles cache API>>.
  22. To evict privileges from the privilege cache, see the
  23. <<security-api-clear-privilege-cache,Clear privileges cache API>>.
  24. To evict API keys from the API key cache, see the
  25. <<security-api-clear-api-key-cache,Clear API key cache API>>.
  26. [[security-api-clear-path-params]]
  27. ==== {api-path-parms-title}
  28. `<realms>`::
  29. (Required, string)
  30. Comma-separated list of realms to clear. To clear all realms, use `*`. Does not
  31. support other wildcard patterns.
  32. `usernames`::
  33. (Optional, list) A comma-separated list of the users to clear from the cache.
  34. If you do not specify this parameter, the API evicts all users from the user
  35. cache.
  36. [[security-api-clear-example]]
  37. ==== {api-examples-title}
  38. For example, to evict all users cached by the `file` realm:
  39. [source,console]
  40. --------------------------------------------------
  41. POST /_security/realm/default_file/_clear_cache
  42. --------------------------------------------------
  43. To evict selected users, specify the `usernames` parameter:
  44. [source,console]
  45. --------------------------------------------------
  46. POST /_security/realm/default_file/_clear_cache?usernames=rdeniro,alpacino
  47. --------------------------------------------------
  48. To clear the caches for multiple realms, specify the realms as a comma-delimited
  49. list:
  50. [source,console]
  51. ------------------------------------------------------------
  52. POST /_security/realm/default_file,ldap1/_clear_cache
  53. ------------------------------------------------------------
  54. To clear the caches for all realms, use `*`.
  55. [source,console]
  56. ----
  57. POST /_security/realm/*/_clear_cache
  58. ----