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.
 
 
 
 
 
 

54 lines
1.3 KiB

  1. #ifndef CACHE_IFACE_H
  2. #define CACHE_IFACE_H
  3. #include <string>
  4. #include <set>
  5. #include "archive.h"
  6. #include "base_cache.h"
  7. namespace cppcms {
  8. using namespace std;
  9. const time_t infty=(sizeof(time_t)==4 ? 0x7FFFFFFF: 0x7FFFFFFFFFFFFFFFULL );
  10. class worker_thread;
  11. class cache_iface {
  12. worker_thread *cms;
  13. set<string> triggers;
  14. public:
  15. void reset() { triggers.clear(); };
  16. cache_iface(worker_thread *w) : cms (w) {};
  17. bool fetch_page(string const &key);
  18. void store_page(string const &key,time_t timeout=infty);
  19. void rise(string const &trigger);
  20. void add_trigger(string const &trigger);
  21. bool fetch_frame(string const &key,string &result);
  22. void store_frame(string const &key,
  23. string const &frame,
  24. set<string> const &triggers=set<string>(),
  25. time_t timeout=infty);
  26. bool fetch_data(string const &key,serializable &data);
  27. void store_data(string const &key,serializable const &data,
  28. set<string> const &triggers=set<string>(),
  29. time_t timeout=infty);
  30. void clear();
  31. bool stats(unsigned &keys,unsigned &triggers);
  32. };
  33. void deflate(string const &text,ostream &stream,long level,long length);
  34. string deflate(string const &text,long level,long length);
  35. class cache_factory {
  36. public:
  37. virtual base_cache *get() const { return NULL; };
  38. virtual void del(base_cache *p) const { };
  39. virtual ~cache_factory() {};
  40. };
  41. }
  42. #endif