Subgroup: Server

Class: QgsServerCacheManager

class qgis.server.QgsServerCacheManager

Bases: sip.wrapper

Constructor

QgsServerCacheManager(copy: QgsServerCacheManager) Copy constructor

A helper class that centralizes caches accesses given by all the server cache filter plugins.

New in version 3.4: 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 image not in cache) like tiles
registerServerCache Register a server cache filter
setCachedDocument Updates or inserts the document in cache like capabilities
setCachedImage Updates or inserts the image in cache like tiles

Signals

Attributes

deleteCachedDocument(self, project: QgsProject, request: QgsServerRequest, accessControl: QgsAccessControl) → bool

Deletes the cached document

Parameters:
  • project – the project used to generate the document to provide path
  • request – the request used to generate the document to provider parameters or data
  • accessControl – the access control to identify different documents for the same request provided by server interface
Returns:

true if the document has been deleted

deleteCachedDocuments(self, project: QgsProject) → bool

Deletes all cached documents for a QGIS project

Parameters:project – the project used to generate the document to provide path
Returns:true if the document has been deleted
deleteCachedImage(self, project: QgsProject, request: QgsServerRequest, accessControl: QgsAccessControl) → bool

Deletes the cached image

Parameters:
  • project – the project used to generate the image to provide path
  • request – the request used to generate the image to provider parameters or data
  • accessControl – the access control to identify different documents for the same request provided by server interface
Returns:

true if the image has been deleted

deleteCachedImages(self, project: QgsProject) → bool

Deletes all cached images for a QGIS project

Parameters:project – the project used to generate the images to provide path
Returns:true if the images have been deleted
getCachedDocument(self, doc: QDomDocument, project: QgsProject, request: QgsServerRequest, accessControl: QgsAccessControl) → bool

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

Parameters:
  • doc – the document to update by content found in cache
  • project – the project used to generate the document to provide path
  • request – the request used to generate the document to provider parameters or data
  • accessControl – the access control to identify different documents for the same request provided by server interface
Returns:

true if the document has been found in cache and the document’s content set

getCachedImage(self, project: QgsProject, request: QgsServerRequest, accessControl: QgsAccessControl) → QByteArray

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

Parameters:
  • project – the project used to generate the image to provide path
  • request – the request used to generate the image to provider parameters or data
  • accessControl – the access control to identify different documents for the same request provided by server interface
Returns:

the cached image or 0 if no corresponding image found

registerServerCache(self, serverCache: QgsServerCacheFilter, priority: int = 0)

Register a server cache filter

Parameters:
  • serverCache – the server cache to add
  • priority – the priority used to define the order
setCachedDocument(self, doc: QDomDocument, project: QgsProject, request: QgsServerRequest, accessControl: QgsAccessControl) → bool

Updates or inserts the document in cache like capabilities

Parameters:
  • doc – the document to cache
  • project – the project used to generate the document to provide path
  • request – the request used to generate the document to provider parameters or data
  • accessControl – the access control to identify different documents for the same request provided by server interface
Returns:

true if the document has been cached

setCachedImage(self, img: Union[QByteArray, bytes, bytearray], project: QgsProject, request: QgsServerRequest, accessControl: QgsAccessControl) → bool

Updates or inserts the image in cache like tiles

Parameters:
  • img – the image to cache
  • project – the project used to generate the image to provide path
  • request – the request used to generate the image to provider parameters or data
  • accessControl – the access control to identify different documents for the same request provided by server interface
Returns:

true if the image has been cached