web_client_cache.h 988 B

12345678910111213141516171819202122232425262728293031
  1. // SPDX-License-Identifier: GPL-3.0-or-later
  2. #ifndef NETDATA_WEB_CLIENT_CACHE_H
  3. #define NETDATA_WEB_CLIENT_CACHE_H
  4. #include "libnetdata/libnetdata.h"
  5. #include "web_client.h"
  6. struct clients_cache {
  7. pid_t pid;
  8. struct web_client *used; // the structures of the currently connected clients
  9. size_t used_count; // the count the currently connected clients
  10. struct web_client *avail; // the cached structures, available for future clients
  11. size_t avail_count; // the number of cached structures
  12. size_t reused; // the number of re-uses
  13. size_t allocated; // the number of allocations
  14. };
  15. extern __thread struct clients_cache web_clients_cache;
  16. extern void web_client_release(struct web_client *w);
  17. extern struct web_client *web_client_get_from_cache_or_allocate();
  18. extern void web_client_cache_destroy(void);
  19. extern void web_client_cache_verify(int force);
  20. #include "web_server.h"
  21. #endif //NETDATA_WEB_CLIENT_CACHE_H