00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #pragma once
00023
00024 #include <boost/thread/mutex.hpp>
00025 #include <boost/unordered_map.hpp>
00026 #include <drizzled/identifier.h>
00027
00028 namespace drizzled {
00029 namespace table {
00030
00031 typedef boost::unordered_multimap<identifier::Table::Key, Concurrent*> CacheMap;
00032 typedef std::pair<CacheMap::const_iterator, CacheMap::const_iterator> CacheRange;
00033
00034 class Cache
00035 {
00036 public:
00037 static CacheMap& getCache()
00038 {
00039 return cache;
00040 }
00041
00042 static void rehash(size_t arg)
00043 {
00044 cache.rehash(arg);
00045 }
00046
00047 static boost::mutex& mutex()
00048 {
00049 return _mutex;
00050 }
00051
00052 static bool areTablesUsed(Table*, bool wait_for_name_lock);
00053 static void removeSchema(const identifier::Schema&);
00054 static bool removeTable(Session&, const identifier::Table&, uint32_t flags);
00055 static void release(table::instance::Shared*);
00056 static void insert(table::Concurrent*);
00057 private:
00058 static CacheMap cache;
00059 static boost::mutex _mutex;
00060 };
00061
00062 CacheMap& getCache();
00063 void remove_table(table::Concurrent*);
00064
00065 }
00066 }
00067