CppCMS
session_storage.h
1 //
3 // Copyright (C) 2008-2012 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
4 //
5 // See accompanying file COPYING.TXT file for licensing details.
6 //
8 #ifndef CPPCMS_SESSION_STORAGE_H
9 #define CPPCMS_SESSION_STORAGE_H
10 
11 #include <cppcms/defs.h>
12 #include <booster/noncopyable.h>
13 #include <booster/shared_ptr.h>
14 #include <string>
15 #include <time.h>
16 
17 namespace cppcms {
18 namespace json {
19  class value;
20 }
21 namespace sessions {
22 
31 
33  {
34  public:
38 
39  virtual void save(std::string const &sid,time_t timeout,std::string const &in) = 0;
40 
45  virtual bool load(std::string const &sid,time_t &timeout,std::string &out) = 0;
46 
50 
51  virtual void remove(std::string const &sid) = 0;
52 
56  virtual bool is_blocking() = 0;
57 
58 
62  virtual ~session_storage()
63  {
64  }
65  };
66 
71  public:
76  virtual booster::shared_ptr<session_storage> get() = 0;
77 
81  virtual bool requires_gc() = 0;
86  virtual void gc_job() {}
91  };
92 
93  extern "C" {
94  typedef session_storage_factory *(*cppcms_session_storage_generator_type)(cppcms::json::value const &options);
95  }
96 
97 
98 } // sessions
99 } // cppcms
100 
101 
102 #endif
virtual ~session_storage_factory()
Definition: session_storage.h:90
This class is central representation of json objects.
Definition: json.h:140
This is the namespace where all CppCMS functionality is placed.
Definition: application.h:19
virtual void gc_job()
Definition: session_storage.h:86
virtual ~session_storage()
Definition: session_storage.h:62
session_server_storage is an abstract class that allows user to implements custom session storage dev...
Definition: session_storage.h:32
This class makes impossible to copy any class derived from this one.
Definition: noncopyable.h:15
The factory is an interface to a factory that creates session_storage objects, it should be thread sa...
Definition: session_storage.h:70