~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/message/cache.h

  • Committer: patrick crews
  • Date: 2011-03-15 12:12:09 UTC
  • mfrom: (1099.4.216 drizzle)
  • Revision ID: gleebix@gmail.com-20110315121209-8g2tkf31w0rx9ter
Tags: 2011.03.12
Updated translations

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#ifndef DRIZZLED_MESSAGE_CACHE_H
22
 
#define DRIZZLED_MESSAGE_CACHE_H
 
21
#pragma once
23
22
 
24
23
#include <boost/unordered_map.hpp>
25
24
#include <boost/shared_ptr.hpp>
30
29
namespace drizzled {
31
30
namespace message {
32
31
 
33
 
typedef boost::unordered_map< drizzled::identifier::Table::Key, drizzled::message::table::shared_ptr> Map;
34
 
 
35
32
class Cache
36
33
{
37
 
  boost::mutex _access;
38
 
  Map cache;
39
 
 
40
34
public:
41
 
  static inline Cache &singleton()
 
35
  static Cache &singleton()
42
36
  {
43
37
    static Cache open_cache;
44
 
 
45
38
    return open_cache;
46
39
  }
47
40
 
55
48
    cache.rehash(arg);
56
49
  }
57
50
 
58
 
  drizzled::message::table::shared_ptr find(const identifier::Table &identifier);
 
51
  table::shared_ptr find(const identifier::Table &identifier);
59
52
  void erase(const identifier::Table &identifier);
60
 
  bool insert(const identifier::Table &identifier, drizzled::message::table::shared_ptr share);
61
 
  bool insert(const identifier::Table &identifier, message::Table &share);
 
53
  bool insert(const identifier::Table &identifier, table::shared_ptr share);
 
54
  bool insert(const identifier::Table &identifier, Table &share);
 
55
private:
 
56
  typedef boost::unordered_map<identifier::Table::Key, table::shared_ptr> Map;
 
57
 
 
58
  boost::mutex _access;
 
59
  Map cache;
62
60
};
63
61
 
64
62
} /* namespace message */
65
63
} /* namespace drizzled */
66
64
 
67
 
#endif /* DRIZZLED_MESSAGE_CACHE_H */