~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session_list.h

  • Committer: Brian Aker
  • Date: 2010-10-15 05:30:39 UTC
  • mfrom: (1843.8.7 trunk-drizzle)
  • Revision ID: brian@tangent.org-20101015053039-ebmv3hnn1yaq4wqy
Merge in refactoring on table (broken it up by type, this will allow me to
insert the new locking).

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#ifndef DRIZZLED_SESSION_CACHE_H
21
 
#define DRIZZLED_SESSION_CACHE_H
 
20
#ifndef DRIZZLED_SESSION_LIST_H
 
21
#define DRIZZLED_SESSION_LIST_H
22
22
 
23
 
#include "drizzled/session.h"
24
23
#include <list>
25
24
 
26
25
namespace drizzled
27
26
{
28
27
 
29
28
class Session;
30
 
 
31
 
namespace session
32
 
{
33
 
 
34
 
class Cache 
35
 
{
36
 
public:
37
 
  typedef std::list<Session::shared_ptr> list;
38
 
 
39
 
  static inline Cache &singleton()
40
 
  {
41
 
    static Cache open_cache;
42
 
 
43
 
    return open_cache;
44
 
  }
45
 
 
46
 
  list &getCache()
47
 
  {
48
 
    return cache;
49
 
  }
50
 
 
51
 
  boost::mutex &mutex()
52
 
  {
53
 
    return _mutex;
54
 
  }
55
 
 
56
 
  void erase(Session::Ptr);
57
 
  void erase(Session::shared_ptr&);
58
 
  size_t count();
59
 
  void insert(Session::shared_ptr &arg);
60
 
 
61
 
  Session::shared_ptr find(const session_id_t &id);
62
 
 
63
 
private:
64
 
  list cache;
65
 
  boost::mutex _mutex;
66
 
};
67
 
 
68
 
} /* namespace session */
69
 
} /* namespace drizzled */
70
 
 
71
 
#endif /* DRIZZLED_SESSION_CACHE_H */
 
29
typedef Session* SessionPtr;
 
30
typedef std::list<SessionPtr> SessionList;
 
31
SessionList &getSessionList();
 
32
 
 
33
}
 
34
 
 
35
#endif /* DRIZZLED_SESSION_LIST_H */