~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session/cache.h

pandora-build v0.71. Added check for avahi.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2009 Sun Microsystems
5
 
 *
6
 
 *  This program is free software; you can redistribute it and/or modify
7
 
 *  it under the terms of the GNU General Public License as published by
8
 
 *  the Free Software Foundation; version 2 of the License.
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 General Public License for more details.
14
 
 *
15
 
 *  You should have received a copy of the GNU General Public License
16
 
 *  along with this program; if not, write to the Free Software
17
 
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 
 */
19
 
 
20
 
#ifndef DRIZZLED_SESSION_CACHE_H
21
 
#define DRIZZLED_SESSION_CACHE_H
22
 
 
23
 
#include "drizzled/session.h"
24
 
#include <list>
25
 
 
26
 
namespace drizzled
27
 
{
28
 
 
29
 
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 */