22 #include <drizzled/pthread_globals.h>
23 #include <drizzled/message/cache.h>
24 #include <drizzled/util/find_ptr.h>
29 table::shared_ptr Cache::find(
const identifier::Table &identifier)
31 boost::mutex::scoped_lock scoped_lock(_access);
32 if (Map::mapped_type* ptr= find_ptr(cache, identifier.getKey()))
34 return table::shared_ptr();
37 void Cache::erase(
const identifier::Table &identifier)
39 boost::mutex::scoped_lock scoped_lock(_access);
40 cache.erase(identifier.getKey());
43 bool Cache::insert(
const identifier::Table &identifier, table::shared_ptr share)
45 boost::mutex::scoped_lock scoped_lock(_access);
46 return cache.insert(std::make_pair(identifier.getKey(), share)).second;
51 return insert(identifier, table::shared_ptr(
new message::Table(message)));