Move index cache to NamespaceDetailsTransient

This commit is contained in:
Aaron
2009-03-03 17:30:26 -05:00
parent 72a7d08cd4
commit 2ba030abe0
8 changed files with 43 additions and 48 deletions

View File

@@ -24,28 +24,6 @@
namespace mongo {
map< string, int > writeCount_;
map< string, map< QueryPattern, pair< BSONObj, int > > > queryCache_;
void registerWriteOp( const string &ns ) {
if ( queryCache_[ ns ].empty() )
return;
if ( ++writeCount_[ ns ] >= 100 )
clearQueryCache( ns );
}
void clearQueryCache( const string &ns ) {
queryCache_[ ns ].clear();
writeCount_[ ns ] = 0;
}
BSONObj indexForPattern( const string &ns, const QueryPattern &pattern ) {
return queryCache_[ ns ][ pattern ].first;
}
int nScannedForPattern( const string &ns, const QueryPattern &pattern ) {
return queryCache_[ ns ][ pattern ].second;
}
void registerIndexForPattern( const string &ns, const QueryPattern &pattern, const BSONObj &indexKey, int nScanned ) {
queryCache_[ ns ][ pattern ] = make_pair( indexKey, nScanned );
}
FieldBound::FieldBound( const BSONElement &e ) :
lower_( minKey.firstElement() ),
lowerInclusive_( true ),