Class: QgsServerCacheFilter

Defines cache interface for QGIS Server plugins.

Added in version 3.4.

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsServerCacheFilter. See the FAQ for more details.

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

class qgis.server.QgsServerCacheFilter[source]

Bases: object

__init__(serverInterface: QgsServerInterface | None)

Constructor QgsServerInterface passed to plugins constructors and must be passed to QgsServerCacheFilter instances.

Parameters:

serverInterface (Optional[QgsServerInterface])

__init__(a0: QgsServerCacheFilter)
Parameters:

a0 (QgsServerCacheFilter)

virtual deleteCachedDocument(self, project: QgsProject | None, request: QgsServerRequest, key: str | 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

  • 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

virtual 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 documents to provide path

Return type:

bool

Returns:

True if the documents have been deleted

virtual deleteCachedImage(self, project: QgsProject | None, request: QgsServerRequest, key: str | 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

  • 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

virtual 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:

True if the images have been deleted

virtual getCachedDocument(self, project: QgsProject | None, request: QgsServerRequest, key: str | None) QByteArray[source]

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

virtual getCachedImage(self, project: QgsProject | None, request: QgsServerRequest, key: str | None) QByteArray[source]

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

virtual setCachedDocument(self, doc: QDomDocument | None, project: QgsProject | None, request: QgsServerRequest, key: str | 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

  • 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

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

Updates or inserts the image in cache like tiles

Parameters:
  • img (Optional[Union[QByteArray, bytes, bytearray]]) – 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