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.
 
 
 
 
 
 

51 lines
1.7 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (C) 2008-2012 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
  4. //
  5. // See accompanying file COPYING.TXT file for licensing details.
  6. //
  7. ///////////////////////////////////////////////////////////////////////////////
  8. #ifndef BASE_CACHE_H
  9. #define BASE_CACHE_H
  10. #include <string>
  11. #include <set>
  12. #include <cppcms/defs.h>
  13. #include <booster/intrusive_ptr.h>
  14. #include <cppcms/cstdint.h>
  15. #include <cppcms/base_cache_fwd.h>
  16. #include <time.h>
  17. namespace cppcms {
  18. namespace impl {
  19. class base_cache {
  20. public:
  21. inline bool fetch(std::string const &key,std::string &a,std::set<std::string> *tags=0)
  22. {
  23. return fetch(key,&a,tags);
  24. }
  25. virtual bool fetch(std::string const &key,std::string *a=0,std::set<std::string> *tags=0,time_t *timeout_out=0,uint64_t *gen=0) = 0;
  26. virtual void store(std::string const &key,std::string const &b,std::set<std::string> const &triggers,time_t timeout,uint64_t const *gen=0) = 0;
  27. virtual void rise(std::string const &trigger) = 0;
  28. virtual void remove(std::string const &key) = 0;
  29. virtual void clear() = 0;
  30. virtual void stats(unsigned &keys,unsigned &triggers) = 0;
  31. virtual void add_ref() = 0;
  32. virtual bool del_ref() = 0;
  33. virtual ~base_cache()
  34. {
  35. }
  36. };
  37. inline void intrusive_ptr_add_ref(cppcms::impl::base_cache *ptr)
  38. {
  39. ptr->add_ref();
  40. }
  41. inline void intrusive_ptr_release(cppcms::impl::base_cache *ptr)
  42. {
  43. if(ptr && ptr->del_ref())
  44. delete ptr;
  45. }
  46. } // impl
  47. } //cppcms
  48. #endif