Class: QgsConfigCache

Cache for server configuration.

Class Hierarchy

Inheritance diagram of qgis.server.QgsConfigCache

Base classes

QObject

class qgis.server.QgsConfigCache[source]

Bases: QObject

__init__(settings: QgsServerSettings | None)

Initialize from settings

Parameters:

settings (Optional[QgsServerSettings])

static initialize(settings: QgsServerSettings | None)[source]

Initialize from settings.

This method must be called prior any call to QgsConfigCache.instance

Parameters:

settings (Optional[QgsServerSettings])

static instance() QgsConfigCache | None[source]

Returns the current instance.

Return type:

Optional[QgsConfigCache]

project(self, path: str | None, settings: QgsServerSettings | None = None) QgsProject | None[source]

If the project is not cached yet, then the project is read from the path. If the project is not available, then None is returned. If the project contains any bad layer it is considered unavailable unless the server configuration variable QGIS_SERVER_IGNORE_BAD_LAYERS passed in the optional settings argument is set to True (the default value is False).

Parameters:
  • path (Optional[str]) – the filename of the QGIS project

  • settings (Optional[QgsServerSettings] = None) – QGIS server settings

Return type:

Optional[QgsProject]

Returns:

the project or None if an error happened

signal projectRemovedFromCache[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

projects(self) List[QgsProject]

Returns projects currently in cache.

Added in version 3.30.

Return type:

List[QgsProject]

removeChangedEntries(self)[source]

Remove all changed cache entries

removeChangedEntry(self, path: str | None)[source]

Remove cache entry

Parameters:

path (Optional[str])

removeEntry(self, path: str | None)[source]

Removes an entry from cache.

Parameters:

path (Optional[str]) – The path of the project

strategyName(self) str[source]

Returns the name of the current strategy

Added in version 3.26.

Return type:

str