ChipMaster's trial hacks on C++CMS starting with v1.2.1. Not sure I'll follow on with the v2 since it looks to be breaking and mostly frivolous.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

44 lines
1.1 KiB

  1. #ifndef TCP_CHACHE_H
  2. #define TCP_CHACHE_H
  3. #include "base_cache.h"
  4. #include "cache_interface.h"
  5. #include <string>
  6. namespace cppcms {
  7. using namespace std;
  8. class messenger;
  9. struct tcp_operation_header;
  10. class tcp_cache : public base_cache {
  11. messenger *tcp;
  12. int conns;
  13. messenger &get(string const &key);
  14. void broadcast(tcp_operation_header &h,string &data);
  15. public:
  16. tcp_cache(vector<string> const &ip_list,vector<long> const &port_list);
  17. virtual bool fetch_page(string const &key,string &output,bool gzip);
  18. virtual bool fetch(string const &key,archive &a,set<string> &tags);
  19. virtual void rise(string const &trigger);
  20. virtual void clear();
  21. virtual void stats(unsigned &keys,unsigned &triggers);
  22. virtual void store(string const &key,set<string> const &triggers,time_t timeout,archive const &a);
  23. virtual ~tcp_cache();
  24. };
  25. class tcp_cache_factory : public cache_factory {
  26. vector<string> ip;
  27. vector<long> port;
  28. public:
  29. tcp_cache_factory(vector<string> const &_ip,vector<long> const &_port) :
  30. ip(_ip),port(_port) {};
  31. virtual base_cache *get() const { return new tcp_cache(ip,port); };
  32. virtual void del(base_cache *p) const { delete p; };
  33. };
  34. }
  35. #endif