QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
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 "qgsservercachefilter.h"
23 #include "qgsaccesscontrol.h"
24 #include "qgsserverrequest.h"
25 
26 #include <QDomDocument>
27 #include "qgis_server.h"
28 #include "qgis_sip.h"
29 
30 class QgsProject;
31 
32 SIP_IF_MODULE( HAVE_SERVER_PYTHON_PLUGINS )
33 
34 
40 class SERVER_EXPORT QgsServerCacheManager
41 {
42 #ifdef SIP_RUN
43 #include "qgsservercachefilter.h"
44 #endif
45 
46  public:
48  QgsServerCacheManager();
49 
51  QgsServerCacheManager( const QgsServerCacheManager &copy );
52 
54  QgsServerCacheManager &operator=( const QgsServerCacheManager &copy );
55 
57  ~QgsServerCacheManager();
58 
67  bool getCachedDocument( QDomDocument *doc, const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl ) const;
68 
77  bool setCachedDocument( const QDomDocument *doc, const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl ) const;
78 
86  bool deleteCachedDocument( const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl ) const;
87 
93  bool deleteCachedDocuments( const QgsProject *project ) const;
94 
102  QByteArray getCachedImage( const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl ) const;
103 
112  bool setCachedImage( const QByteArray *img, const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl ) const;
113 
121  bool deleteCachedImage( const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl ) const;
122 
128  bool deleteCachedImages( const QgsProject *project ) const;
129 
135  void registerServerCache( QgsServerCacheFilter *serverCache, int priority = 0 );
136 
137  private:
138  QString getCacheKey( bool &cache, QgsAccessControl *accessControl ) const;
140  std::unique_ptr<QgsServerCacheFilterMap> mPluginsServerCaches = nullptr;
141 };
142 
143 #endif
#define SIP_IF_MODULE(condition)
Definition: qgis_sip.h:28
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.
Definition: qgsproject.h:89
Class defining cache interface for QGIS Server plugins.
QgsServerRequest Class defining request interface passed to services QgsService::executeRequest() met...
A helper class that centralizes restrictions given by all the access control filter plugins...