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.
 
 
 
 
 
 

61 lines
2.2 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (C) 2008-2010 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
  4. //
  5. // This program is free software: you can redistribute it and/or modify
  6. // it under the terms of the GNU Lesser General Public License as published by
  7. // the Free Software Foundation, either version 3 of the License, or
  8. // (at your option) any later version.
  9. //
  10. // This program is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. // GNU Lesser General Public License for more details.
  14. //
  15. // You should have received a copy of the GNU Lesser General Public License
  16. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. //
  18. ///////////////////////////////////////////////////////////////////////////////
  19. #ifndef BASE_CACHE_H
  20. #define BASE_CACHE_H
  21. #include <string>
  22. #include <set>
  23. #include "defs.h"
  24. #include "intrusive_ptr.h"
  25. #include "cstdint.h"
  26. namespace cppcms {
  27. namespace impl {
  28. class base_cache {
  29. public:
  30. inline bool fetch(std::string const &key,std::string &a,std::set<std::string> *tags=0)
  31. {
  32. return fetch(key,&a,tags);
  33. }
  34. 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;
  35. 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;
  36. virtual void rise(std::string const &trigger) = 0;
  37. virtual void remove(std::string const &key) = 0;
  38. virtual void clear() = 0;
  39. virtual void stats(unsigned &keys,unsigned &triggers) = 0;
  40. virtual void add_ref() = 0;
  41. virtual bool del_ref() = 0;
  42. virtual ~base_cache()
  43. {
  44. }
  45. };
  46. } // impl
  47. inline void intrusive_ptr_add_ref(impl::base_cache *ptr)
  48. {
  49. ptr->add_ref();
  50. }
  51. inline void intrusive_ptr_release(impl::base_cache *ptr)
  52. {
  53. if(ptr && ptr->del_ref())
  54. delete ptr;
  55. }
  56. } // cppcms
  57. #endif