00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #pragma once
00021
00022 #include <boost/thread/condition_variable.hpp>
00023 #include <boost/thread/mutex.hpp>
00024 #include <drizzled/visibility.h>
00025 #include <drizzled/common_fwd.h>
00026 #include <list>
00027
00028 namespace drizzled {
00029 namespace session {
00030
00031 class DRIZZLED_API Cache
00032 {
00033 typedef boost::shared_ptr<drizzled::Session> session_ptr;
00034 public:
00035 typedef std::list<session_ptr> list;
00036
00037 static list &getCache()
00038 {
00039 return cache;
00040 }
00041
00042 static boost::mutex &mutex()
00043 {
00044 return _mutex;
00045 }
00046
00047 static boost::condition_variable &cond()
00048 {
00049 return _end;
00050 }
00051
00052 static void shutdownFirst();
00053 static void shutdownSecond();
00054
00055 static void erase(const session_ptr&);
00056 static size_t count();
00057 static void insert(const session_ptr&);
00058
00059 static session_ptr find(const session_id_t&);
00060
00061 private:
00062 static bool volatile _ready_to_exit;
00063 static list cache;
00064 static boost::mutex _mutex;
00065 static boost::condition_variable _end;
00066 };
00067
00068 }
00069 }
00070