QGIS API Documentation  3.4.15-Madeira (e83d02e274)
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 <QMultiMap>
27 #include <QDomDocument>
28 #include "qgis_server.h"
29 #include "qgis_sip.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:
49  QgsServerCacheManager();
50 
52  QgsServerCacheManager( const QgsServerCacheManager &copy );
53 
55  QgsServerCacheManager &operator=( const QgsServerCacheManager &copy );
56 
58  ~QgsServerCacheManager();
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;
141  std::unique_ptr<QgsServerCacheFilterMap> mPluginsServerCaches = nullptr;
142 };
143 
144 #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...
Reads and writes project states.
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...