28 if ( copy.mPluginsServerCaches )
34 mPluginsServerCaches.reset(
nullptr );
40 if ( copy.mPluginsServerCaches )
46 mPluginsServerCaches.reset(
nullptr );
53 mPluginsServerCaches.reset();
59 QString key = getCacheKey( cache, accessControl );
67 QgsServerCacheFilterMap::const_iterator scIterator;
68 for ( scIterator = mPluginsServerCaches->constBegin(); scIterator != mPluginsServerCaches->constEnd(); ++scIterator )
70 content = scIterator.value()->getCachedDocument( project, request, key );
71 if ( !content.isEmpty() )
76 if ( content.isEmpty() )
81 if ( !doc->setContent( content ) )
92 QString key = getCacheKey( cache, accessControl );
99 QgsServerCacheFilterMap::const_iterator scIterator;
100 for ( scIterator = mPluginsServerCaches->constBegin(); scIterator != mPluginsServerCaches->constEnd(); ++scIterator )
102 if ( scIterator.value()->setCachedDocument( doc, project, request, key ) )
113 QString key = getCacheKey( cache, accessControl );
115 QgsServerCacheFilterMap::const_iterator scIterator;
116 for ( scIterator = mPluginsServerCaches->constBegin(); scIterator != mPluginsServerCaches->constEnd(); ++scIterator )
118 if ( scIterator.value()->deleteCachedDocument( project, request, key ) )
128 QgsServerCacheFilterMap::const_iterator scIterator;
129 for ( scIterator = mPluginsServerCaches->constBegin(); scIterator != mPluginsServerCaches->constEnd(); ++scIterator )
131 if ( scIterator.value()->deleteCachedDocuments( project ) )
142 QString key = getCacheKey( cache, accessControl );
144 QgsServerCacheFilterMap::const_iterator scIterator;
145 for ( scIterator = mPluginsServerCaches->constBegin(); scIterator != mPluginsServerCaches->constEnd(); ++scIterator )
147 QByteArray content = scIterator.value()->getCachedImage( project, request, key );
148 if ( !content.isEmpty() )
159 QString key = getCacheKey( cache, accessControl );
161 QgsServerCacheFilterMap::const_iterator scIterator;
162 for ( scIterator = mPluginsServerCaches->constBegin(); scIterator != mPluginsServerCaches->constEnd(); ++scIterator )
164 if ( scIterator.value()->setCachedImage( img, project, request, key ) )
175 QString key = getCacheKey( cache, accessControl );
177 QgsServerCacheFilterMap::const_iterator scIterator;
178 for ( scIterator = mPluginsServerCaches->constBegin(); scIterator != mPluginsServerCaches->constEnd(); ++scIterator )
180 if ( scIterator.value()->deleteCachedImage( project, request, key ) )
190 QgsServerCacheFilterMap::const_iterator scIterator;
191 for ( scIterator = mPluginsServerCaches->constBegin(); scIterator != mPluginsServerCaches->constEnd(); ++scIterator )
193 if ( scIterator.value()->deleteCachedImages( project ) )
203 mPluginsServerCaches->insert( priority, serverCache );
206 QString QgsServerCacheManager::getCacheKey(
bool &cache,
QgsAccessControl *accessControl )
const 208 QStringList cacheKeyList;
217 return cacheKeyList.join(
'-' );
void registerServerCache(QgsServerCacheFilter *serverCache, int priority=0)
Register a server cache filter.
bool fillCacheKey(QStringList &cacheKey) const
Fill the capabilities caching key.
~QgsServerCacheManager()
Destructor.
bool setCachedImage(const QByteArray *img, const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl) const
Updates or inserts the image in cache like tiles.
bool deleteCachedDocument(const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl) const
Deletes the cached document.
bool deleteCachedDocuments(const QgsProject *project) const
Deletes all cached documents for a QGIS project.
A helper class that centralizes caches accesses given by all the server cache filter plugins...
Encapsulates a QGIS project, including sets of map layers and their styles, layouts, annotations, canvases, etc.
QgsServerCacheManager & operator=(const QgsServerCacheManager ©)
Assignment operator.
Class defining cache interface for QGIS Server plugins.
bool getCachedDocument(QDomDocument *doc, const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl) const
Returns cached document (or 0 if document not in cache) like capabilities.
QgsServerRequest Class defining request interface passed to services QgsService::executeRequest() met...
QMultiMap< int, QgsServerCacheFilter * > QgsServerCacheFilterMap
The registry definition.
bool setCachedDocument(const QDomDocument *doc, const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl) const
Updates or inserts the document in cache like capabilities.
A helper class that centralizes restrictions given by all the access control filter plugins...
QgsServerCacheManager()
Constructor.
bool deleteCachedImages(const QgsProject *project) const
Deletes all cached images for a QGIS project.
bool deleteCachedImage(const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl) const
Deletes the cached image.
QByteArray getCachedImage(const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl) const
Returns cached image (or 0 if image not in cache) like tiles.