http_client_cache.h 861 B

123456789101112131415161718192021222324252627282930
  1. #pragma once
  2. #include "http_define.h"
  3. #if USE_NET_HTTP_CLIENT
  4. namespace ylib
  5. {
  6. namespace network
  7. {
  8. namespace http
  9. {
  10. class client_plus;
  11. //客户端缓存
  12. class client_cache
  13. {
  14. public:
  15. client_cache();
  16. ~client_cache();
  17. void open(const std::string& dirpath);
  18. bool read(network::http::client_plus* client, ylib::buffer& cache);
  19. void set_header(network::http::client_plus* client, const std::string& url);
  20. void close();
  21. void write(network::http::client_plus* client);
  22. bool read(const std::string& url, ylib::buffer& cache);
  23. private:
  24. bool m_open;
  25. std::string m_dirpath;
  26. };
  27. }
  28. }
  29. }
  30. #endif