http_cache.h 916 B

123456789101112131415161718192021222324252627282930313233
  1. #pragma once
  2. #include "http_define.h"
  3. #include "http_reqpack.h"
  4. #include "http_interface.h"
  5. #include "util/map.hpp"
  6. namespace ylib
  7. {
  8. namespace network
  9. {
  10. namespace http
  11. {
  12. class cache :public network::http::interface_, public ylib::error_base
  13. {
  14. public:
  15. cache();
  16. ~cache();
  17. bool start(const server_cache_config& config);
  18. void stop();
  19. bool have_send(network::http::reqpack* rp);
  20. bool enable();
  21. std::string make_key(const std::string& filepath);
  22. bool find_ext(const std::string& filepath);
  23. std::string make_cache_filepath(const std::string& filepath);
  24. private:
  25. server_cache_config m_config;
  26. ylib::map<std::string, std::string> m_keys;
  27. };
  28. }
  29. }
  30. }