Class: QgsServerCacheFilter

class qgis.server.QgsServerCacheFilter

Bases: sip.wrapper

Class defining cache interface for QGIS Server plugins.

Added in version 3.4.

QgsServerCacheFilter(serverInterface: Optional[QgsServerInterface]) Constructor QgsServerInterface passed to plugins constructors and must be passed to QgsServerCacheFilter instances.

QgsServerCacheFilter(a0: QgsServerCacheFilter)

Methods

deleteCachedDocument

Deletes the cached document

deleteCachedDocuments

Deletes all cached documents for a QGIS project

deleteCachedImage

Deletes the cached image

deleteCachedImages

Deletes all cached images for a QGIS project

getCachedDocument

Returns cached document (or 0 if document not in cache) like capabilities

getCachedImage

Returns cached image (or 0 if document not in cache) like tiles

setCachedDocument

Updates or inserts the document in cache like capabilities

setCachedImage

Updates or inserts the image in cache like tiles

deleteCachedDocument(self, project: QgsProject | None, request: QgsServerRequest, key: str | None) bool

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

  • key (Optional[str]) – the key provided by the access control to identify different documents for the same request

Return type:

bool

Returns:

True if the document has been deleted

deleteCachedDocuments(self, project: QgsProject | None) bool

Deletes all cached documents for a QGIS project

Parameters:

project (Optional[QgsProject]) – the project used to generate the documents to provide path

Return type:

bool

Returns:

True if the documents have been deleted

deleteCachedImage(self, project: QgsProject | None, request: QgsServerRequest, key: str | None) bool

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

  • key (Optional[str]) – the key provided by the access control to identify different images for the same request

Return type:

bool

Returns:

True if the image has been deleted

deleteCachedImages(self, project: QgsProject | None) bool

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:

True if the images have been deleted

getCachedDocument(self, project: QgsProject | None, request: QgsServerRequest, key: str | None) QByteArray

Returns cached document (or 0 if document not in cache) like capabilities

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

  • key (Optional[str]) – the key provided by the access control to identify different documents for the same request

Return type:

QByteArray

Returns:

QByteArray of the cached document or an empty one if no corresponding document found

getCachedImage(self, project: QgsProject | None, request: QgsServerRequest, key: str | None) QByteArray

Returns cached image (or 0 if document 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

  • key (Optional[str]) – the key provided by the access control to identify different images for the same request

Return type:

QByteArray

Returns:

QByteArray of the cached image or an empty one if no corresponding image found

setCachedDocument(self, doc: QDomDocument | None, project: QgsProject | None, request: QgsServerRequest, key: str | None) bool

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

  • key (Optional[str]) – the key provided by the access control to identify different documents for the same request

Return type:

bool

Returns:

True if the document has been cached

setCachedImage(self, img: QByteArray | bytes | bytearray | None, project: QgsProject | None, request: QgsServerRequest, key: str | None) bool

Updates or inserts the image in cache like tiles

Parameters:
  • img (Optional[Union[QByteArray) – the document 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

  • key (Optional[str]) – the key provided by the access control to identify different images for the same request

Return type:

bool

Returns:

True if the image has been cached