QGIS API Documentation 3.99.0-Master (21b3aa880ba)
Loading...
Searching...
No Matches
qgsservercachemanager.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsservercachemanager.h
3 -----------------------
4
5 begin : 2018-07-05
6 copyright : (C) 2018 by René-Luc D'Hont
7 email : rldhont at 3liz dot com
8 ***************************************************************************/
9
10/***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18
19#ifndef QGSSERVERCACHEMANAGER_H
20#define QGSSERVERCACHEMANAGER_H
21
22#include "qgis_server.h"
23#include "qgis_sip.h"
24#include "qgsaccesscontrol.h"
26#include "qgsserverrequest.h"
27#include "qgsserversettings.h"
28
29#include <QDomDocument>
30
31class QgsProject;
32
33SIP_IF_MODULE( HAVE_SERVER_PYTHON_PLUGINS )
34
35
41class SERVER_EXPORT QgsServerCacheManager
42{
43#ifdef SIP_RUN
45#endif
46
47 public:
50
54
63 bool getCachedDocument( QDomDocument *doc, const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl ) const;
64
73 bool setCachedDocument( const QDomDocument *doc, const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl ) const;
74
82 bool deleteCachedDocument( const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl ) const;
83
89 bool deleteCachedDocuments( const QgsProject *project ) const;
90
98 QByteArray getCachedImage( const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl ) const;
99
108 bool setCachedImage( const QByteArray *img, const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl ) const;
109
117 bool deleteCachedImage( const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl ) const;
118
124 bool deleteCachedImages( const QgsProject *project ) const;
125
131 void registerServerCache( QgsServerCacheFilter *serverCache, int priority = 0 );
132
133 private:
134 QString getCacheKey( bool &cache, QgsAccessControl *accessControl, const QgsServerRequest &request ) const;
136 std::unique_ptr<QgsServerCacheFilterMap> mPluginsServerCaches = nullptr;
137 const QgsServerSettings &mSettings;
138};
139
140#endif
A helper class that centralizes restrictions given by all the access control filter plugins.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:109
Defines cache interface for QGIS Server plugins.
void registerServerCache(QgsServerCacheFilter *serverCache, int priority=0)
Register a server cache filter.
bool deleteCachedDocuments(const QgsProject *project) const
Deletes all cached documents for a QGIS project.
QgsServerCacheManager & operator=(const QgsServerCacheManager &copy)
bool deleteCachedImages(const QgsProject *project) const
Deletes all cached images for a QGIS project.
bool deleteCachedDocument(const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl) const
Deletes the cached document.
bool setCachedDocument(const QDomDocument *doc, const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl) const
Updates or inserts the document in cache like capabilities.
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.
bool setCachedImage(const QByteArray *img, const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl) const
Updates or inserts the image in cache like tiles.
bool deleteCachedImage(const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl) const
Deletes the cached image.
QgsServerCacheManager(const QgsServerSettings &settings=QgsServerSettings())
Constructor.
QByteArray getCachedImage(const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl) const
Returns cached image (or 0 if image not in cache) like tiles.
Defines requests passed to QgsService classes.
Provides a way to retrieve settings by prioritizing according to environment variables,...
#define SIP_IF_MODULE(condition)
Definition qgis_sip.h:28