~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to drizzled/definition/cache.cc

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-06-19 10:46:49 UTC
  • mfrom: (1.1.6)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20120619104649-e2l0ggd4oz3um0f4
Tags: upstream-7.1.36-stable
ImportĀ upstreamĀ versionĀ 7.1.36-stable

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#include <drizzled/util/find_ptr.h>
32
32
 
33
33
namespace drizzled {
34
 
 
35
34
namespace definition {
36
35
 
 
36
Cache::Map Cache::cache;
 
37
boost::mutex Cache::_mutex;
 
38
 
37
39
table::instance::Shared::shared_ptr Cache::find(const identifier::Table::Key &key)
38
40
{
39
41
  boost::mutex::scoped_lock scopedLock(_mutex);
52
54
bool Cache::insert(const identifier::Table::Key &key, table::instance::Shared::shared_ptr share)
53
55
{
54
56
  boost::mutex::scoped_lock scopedLock(_mutex);
55
 
  std::pair<Map::iterator, bool> ret=
56
 
    cache.insert(std::make_pair(key, share));
 
57
  std::pair<Map::iterator, bool> ret= cache.insert(std::make_pair(key, share));
57
58
 
58
59
  return ret.second;
59
60
}
62
63
{
63
64
  boost::mutex::scoped_lock scopedLock(_mutex);
64
65
 
65
 
  vector.reserve(definition::Cache::singleton().size());
 
66
  vector.reserve(definition::Cache::size());
66
67
 
67
 
  std::transform(cache.begin(),
68
 
                 cache.end(),
69
 
                 std::back_inserter(vector),
70
 
                 boost::bind(&Map::value_type::second, _1) );
 
68
  std::transform(cache.begin(), cache.end(), std::back_inserter(vector), boost::bind(&Map::value_type::second, _1));
71
69
  assert(vector.size() == cache.size());
72
70
}
73
71