Skip to content
Permalink
Browse files

Maximum 40 entries in config and capabilities cache

  • Loading branch information
mhugent committed May 11, 2011
1 parent a09d043 commit 89fe2289f15e7d9268efdd82cf68c721d77c85af
Showing with 8 additions and 5 deletions.
  1. +6 −0 src/mapserver/qgscapabilitiescache.cpp
  2. +2 −5 src/mapserver/qgsconfigcache.cpp
@@ -40,5 +40,11 @@ const QDomDocument* QgsCapabilitiesCache::searchCapabilitiesDocument( const QStr

void QgsCapabilitiesCache::insertCapabilitiesDocument( const QString& configFilePath, const QDomDocument* doc )
{
if( mCachedCapabilities.size() > 40 )
{
//remove another cache entry to avoid memory problems
QHash<QString, QDomDocument>::iterator capIt = mCachedCapabilities.begin();
mCachedCapabilities.erase( capIt );
}
mCachedCapabilities.insert( configFilePath, doc->cloneNode().toDocument() );
}
@@ -61,12 +61,9 @@ QgsConfigParser* QgsConfigCache::insertConfiguration( const QString& filePath )
{
if ( mCachedConfigurations.size() > 40 )
{
//remove 10 elements to avoid memory problems
//remove a cache entry to avoid memory problems
QHash<QString, QgsConfigParser*>::iterator configIt = mCachedConfigurations.begin();
for ( int i = 0; i < 10; ++i )
{
configIt = mCachedConfigurations.erase( configIt );
}
mCachedConfigurations.erase( configIt );
}

//first open file

0 comments on commit 89fe228

Please sign in to comment.
You can’t perform that action at this time.