~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/definition/cache.h

  • Committer: Lee Bieber
  • Date: 2010-11-14 05:18:07 UTC
  • mfrom: (1921.4.12 catalogs)
  • Revision ID: kalebral@gmail.com-20101114051807-p69h40jbsn1byf84
Merge Brian - add execute with no return

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#ifndef DRIZZLED_DEFINITION_CACHE_H
22
22
#define DRIZZLED_DEFINITION_CACHE_H
23
23
 
24
 
#include "drizzled/definition/table.h"
25
 
 
26
24
namespace drizzled {
27
25
 
28
 
namespace generator {
29
 
class TableDefinitionCache;
30
 
}
 
26
typedef boost::shared_ptr<TableShare> TableSharePtr;
31
27
 
32
28
namespace definition {
33
29
 
 
30
typedef boost::unordered_map< TableIdentifier::Key, TableSharePtr> CacheMap;
 
31
 
34
32
class Cache
35
33
{
 
34
  CacheMap cache;
 
35
 
36
36
public:
37
37
  static inline Cache &singleton()
38
38
  {
41
41
    return open_cache;
42
42
  }
43
43
 
 
44
  CacheMap &getCache()
 
45
  {
 
46
    return cache;
 
47
  }
 
48
 
44
49
  size_t size() const
45
50
  {
46
51
    return cache.size();
51
56
    cache.rehash(arg);
52
57
  }
53
58
 
54
 
  TableShare::shared_ptr find(const TableIdentifier::Key &identifier);
55
 
  void erase(const TableIdentifier::Key &identifier);
56
 
  bool insert(const TableIdentifier::Key &identifier, TableShare::shared_ptr share);
57
 
 
58
 
protected:
59
 
  friend class drizzled::generator::TableDefinitionCache;
60
 
 
61
 
  void CopyFrom(TableShare::vector &vector);
62
 
 
63
 
private:
64
 
  typedef boost::unordered_map< TableIdentifier::Key, TableShare::shared_ptr> Map;
65
 
 
66
 
  Map cache;
67
 
  boost::mutex _mutex;
 
59
  TableSharePtr find(const TableIdentifier &identifier);
 
60
  void erase(const TableIdentifier &identifier);
 
61
  bool insert(const TableIdentifier &identifier, TableSharePtr share);
68
62
};
69
63
 
70
64
} /* namespace definition */