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 
16 namespace cppcms {
17 namespace json {
18  class value;
19 }
20 namespace sessions {
21 
30 
32  {
33  public:
37 
38  virtual void save(std::string const &sid,time_t timeout,std::string const &in) = 0;
39 
44  virtual bool load(std::string const &sid,time_t &timeout,std::string &out) = 0;
45 
49 
50  virtual void remove(std::string const &sid) = 0;
51 
55  virtual bool is_blocking() = 0;
56 
57 
61  virtual ~session_storage()
62  {
63  }
64  };
65 
70  public:
75  virtual booster::shared_ptr<session_storage> get() = 0;
76 
80  virtual bool requires_gc() = 0;
85  virtual void gc_job() {}
90  };
91 
92  extern "C" {
93  typedef session_storage_factory *(*cppcms_session_storage_generator_type)(cppcms::json::value const &options);
94  }
95 
96 
97 } // sessions
98 } // cppcms
99 
100 
101 #endif
virtual ~session_storage_factory()
Definition: session_storage.h:89
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:85
Definition: log.h:25
virtual ~session_storage()
Definition: session_storage.h:61
session_server_storage is an abstract class that allows user to implements custom session storage dev...
Definition: session_storage.h:31
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:69