Class: QgsServerCacheManager¶
A helper class that centralizes caches accesses given by all the server cache filter plugins.
Added in version 3.4.
Methods
Deletes the cached document  | 
|
Deletes all cached documents for a QGIS project  | 
|
Deletes the cached image  | 
|
Deletes all cached images for a QGIS project  | 
|
Returns cached document (or 0 if document not in cache) like capabilities  | 
|
Returns cached image (or 0 if image not in cache) like tiles  | 
|
Register a server cache filter  | 
|
Updates or inserts the document in cache like capabilities  | 
|
Updates or inserts the image in cache like tiles  | 
- class qgis.server.QgsServerCacheManager[source]¶
 Bases:
object- __init__(settings: QgsServerSettings = QgsServerSettings())
 Constructor
- Parameters:
 settings (
QgsServerSettings= QgsServerSettings())
- __init__(copy: QgsServerCacheManager)
 - Parameters:
 copy (QgsServerCacheManager)
- deleteCachedDocument(self, project: QgsProject | None, request: QgsServerRequest, accessControl: QgsAccessControl | None) bool[source]¶
 Deletes the cached document
- Parameters:
 project (Optional[QgsProject]) – the project used to generate the document to provide path
request (QgsServerRequest) – the request used to generate the document to provider parameters or data
accessControl (Optional[QgsAccessControl]) – the access control to identify different documents for the same request provided by server interface
- Return type:
 bool
- Returns:
 Trueif the document has been deleted
- deleteCachedDocuments(self, project: QgsProject | None) bool[source]¶
 Deletes all cached documents for a QGIS project
- Parameters:
 project (Optional[QgsProject]) – the project used to generate the document to provide path
- Return type:
 bool
- Returns:
 Trueif the document has been deleted
- deleteCachedImage(self, project: QgsProject | None, request: QgsServerRequest, accessControl: QgsAccessControl | None) bool[source]¶
 Deletes the cached image
- Parameters:
 project (Optional[QgsProject]) – the project used to generate the image to provide path
request (QgsServerRequest) – the request used to generate the image to provider parameters or data
accessControl (Optional[QgsAccessControl]) – the access control to identify different documents for the same request provided by server interface
- Return type:
 bool
- Returns:
 Trueif the image has been deleted
- deleteCachedImages(self, project: QgsProject | None) bool[source]¶
 Deletes all cached images for a QGIS project
- Parameters:
 project (Optional[QgsProject]) – the project used to generate the images to provide path
- Return type:
 bool
- Returns:
 Trueif the images have been deleted
- getCachedDocument(self, doc: QDomDocument | None, project: QgsProject | None, request: QgsServerRequest, accessControl: QgsAccessControl | None) bool[source]¶
 Returns cached document (or 0 if document not in cache) like capabilities
- Parameters:
 doc (Optional[QDomDocument]) – the document to update by content found in cache
project (Optional[QgsProject]) – the project used to generate the document to provide path
request (QgsServerRequest) – the request used to generate the document to provider parameters or data
accessControl (Optional[QgsAccessControl]) – the access control to identify different documents for the same request provided by server interface
- Return type:
 bool
- Returns:
 Trueif the document has been found in cache and the document’s content set
- getCachedImage(self, project: QgsProject | None, request: QgsServerRequest, accessControl: QgsAccessControl | None) QByteArray[source]¶
 Returns cached image (or 0 if image not in cache) like tiles
- Parameters:
 project (Optional[QgsProject]) – the project used to generate the image to provide path
request (QgsServerRequest) – the request used to generate the image to provider parameters or data
accessControl (Optional[QgsAccessControl]) – the access control to identify different documents for the same request provided by server interface
- Return type:
 QByteArray
- Returns:
 the cached image or 0 if no corresponding image found
- registerServerCache(self, serverCache: QgsServerCacheFilter | None, priority: int = 0)[source]¶
 Register a server cache filter
- Parameters:
 serverCache (Optional[QgsServerCacheFilter]) – the server cache to add
priority (int = 0) – the priority used to define the order
- setCachedDocument(self, doc: QDomDocument | None, project: QgsProject | None, request: QgsServerRequest, accessControl: QgsAccessControl | None) bool[source]¶
 Updates or inserts the document in cache like capabilities
- Parameters:
 doc (Optional[QDomDocument]) – the document to cache
project (Optional[QgsProject]) – the project used to generate the document to provide path
request (QgsServerRequest) – the request used to generate the document to provider parameters or data
accessControl (Optional[QgsAccessControl]) – the access control to identify different documents for the same request provided by server interface
- Return type:
 bool
- Returns:
 Trueif the document has been cached
- setCachedImage(self, img: QByteArray | bytes | bytearray | None, project: QgsProject | None, request: QgsServerRequest, accessControl: QgsAccessControl | None) bool[source]¶
 Updates or inserts the image in cache like tiles
- Parameters:
 img (Optional[Union[QByteArray, bytes, bytearray]]) – the image to cache
project (Optional[QgsProject]) – the project used to generate the image to provide path
request (QgsServerRequest) – the request used to generate the image to provider parameters or data
accessControl (Optional[QgsAccessControl]) – the access control to identify different documents for the same request provided by server interface
- Return type:
 bool
- Returns:
 Trueif the image has been cached