Skip to content

Commit

Permalink
Remove the corresponding capabilities doc in cache when a project is …
Browse files Browse the repository at this point in the history
…removed from cache
  • Loading branch information
pblottiere committed Mar 20, 2024
1 parent ec30cab commit 8894e5d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/server/qgscapabilitiescache.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ class SERVER_EXPORT QgsCapabilitiesCache : public QObject
*/
void removeCapabilitiesDocument( const QString &path );

public slots:
//! Removes changed entry from this cache
void removeChangedEntry( const QString &path );

private:
QHash< QString, QHash< QString, QDomDocument > > mCachedCapabilities;
QHash< QString, QDateTime> mCachedCapabilitiesTimestamps;
Expand All @@ -67,8 +71,6 @@ class SERVER_EXPORT QgsCapabilitiesCache : public QObject
int mCacheSize;

private slots:
//! Removes changed entry from this cache
void removeChangedEntry( const QString &path );
//! Remove outdated enties
void removeOutdatedEntries();
};
Expand Down
2 changes: 2 additions & 0 deletions src/server/qgsconfigcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ void QgsConfigCache::removeEntry( const QString &path )
mXmlDocumentCache.remove( path );

mStrategy->entryRemoved( path );

emit projectRemovedFromCache(path);
}

// slots
Expand Down
3 changes: 3 additions & 0 deletions src/server/qgsconfigcache.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ class SERVER_EXPORT QgsConfigCache : public QObject
//! Initialize with a strategy implementation.
QgsConfigCache( QgsAbstractCacheStrategy *strategy ) SIP_SKIP;

signals:
void projectRemovedFromCache( const QString &path );

private:
// SIP require this
QgsConfigCache() SIP_FORCE;
Expand Down
2 changes: 2 additions & 0 deletions src/server/qgsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,8 @@ bool QgsServer::init()
// Initialize config cache
QgsConfigCache::initialize( sSettings );

QObject::connect(QgsConfigCache::instance(), &QgsConfigCache::projectRemovedFromCache, sCapabilitiesCache, &QgsCapabilitiesCache::removeChangedEntry);

sInitialized = true;
QgsMessageLog::logMessage( QStringLiteral( "Server initialized" ), QStringLiteral( "Server" ), Qgis::MessageLevel::Info );
return true;
Expand Down

0 comments on commit 8894e5d

Please sign in to comment.