QGIS API Documentation  3.24.2-Tisler (13c1a02865)
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 #include "qgsserversettings.h"
30 
31 class QgsProject;
32 
33 SIP_IF_MODULE( HAVE_SERVER_PYTHON_PLUGINS )
34 
35 
41 class SERVER_EXPORT QgsServerCacheManager
42 {
43 #ifdef SIP_RUN
44 #include "qgsservercachefilter.h"
45 #endif
46 
47  public:
50 
53 
55  QgsServerCacheManager &operator=( const QgsServerCacheManager &copy );
56 
59 
68  bool getCachedDocument( QDomDocument *doc, const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl ) const;
69 
78  bool setCachedDocument( const QDomDocument *doc, const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl ) const;
79 
87  bool deleteCachedDocument( const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl ) const;
88 
94  bool deleteCachedDocuments( const QgsProject *project ) const;
95 
103  QByteArray getCachedImage( const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl ) const;
104 
113  bool setCachedImage( const QByteArray *img, const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl ) const;
114 
122  bool deleteCachedImage( const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl ) const;
123 
129  bool deleteCachedImages( const QgsProject *project ) const;
130 
136  void registerServerCache( QgsServerCacheFilter *serverCache, int priority = 0 );
137 
138  private:
139  QString getCacheKey( bool &cache, QgsAccessControl *accessControl, const QgsServerRequest &request ) const;
141  std::unique_ptr<QgsServerCacheFilterMap> mPluginsServerCaches = nullptr;
142  const QgsServerSettings &mSettings;
143 };
144 
145 #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:101
Class defining cache interface for QGIS Server plugins.
A helper class that centralizes caches accesses given by all the server cache filter plugins.
QgsServerRequest Class defining request interface passed to services QgsService::executeRequest() met...
Provides a way to retrieve settings by prioritizing according to environment variables,...
#define SIP_IF_MODULE(condition)
Definition: qgis_sip.h:28