~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/message/cache.cc

  • Committer: Olaf van der Spek
  • Date: 2011-02-24 12:53:01 UTC
  • mto: (2209.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2207.
  • Revision ID: olafvdspek@gmail.com-20110224125301-mjvdptl074cdwc84
Refactor drizzled/message/cache

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 */
20
20
 
21
21
#include <config.h>
22
 
 
23
22
#include <drizzled/pthread_globals.h>
24
23
#include <drizzled/message/cache.h>
25
24
#include <drizzled/util/find_ptr.h>
26
25
 
27
26
namespace drizzled {
28
 
 
29
27
namespace message {
30
28
 
31
29
table::shared_ptr Cache::find(const identifier::Table &identifier)
39
37
void Cache::erase(const identifier::Table &identifier)
40
38
{
41
39
  boost_unique_lock_t scoped_lock(_access);
42
 
  
43
40
  cache.erase(identifier.getKey());
44
41
}
45
42
 
46
43
bool Cache::insert(const identifier::Table &identifier, table::shared_ptr share)
47
44
{
48
45
  boost_unique_lock_t scoped_lock(_access);
49
 
 
50
 
  std::pair<Map::iterator, bool> ret= cache.insert(std::make_pair(identifier.getKey(), share));
51
 
 
52
 
  return ret.second;
 
46
  return cache.insert(std::make_pair(identifier.getKey(), share)).second;
53
47
}
54
48
 
55
49
bool Cache::insert(const identifier::Table &identifier, drizzled::message::Table &message)
57
51
  return insert(identifier, table::shared_ptr(new message::Table(message)));
58
52
}
59
53
 
60
 
} /* namespace definition */
61
 
} /* namespace drizzled */
 
54
} // namespace message
 
55
} // namespace drizzled