Class: QgsConfigCache

Cache for server configuration.

Class Hierarchy

Inheritance diagram of qgis.server.QgsConfigCache

Base classes

QObject

Methods

project

If the project is not cached yet, then the project is read from the path.

projects

Returns projects currently in cache.

removeChangedEntries

Remove all changed cache entries

removeChangedEntry

Remove cache entry

removeEntry

Removes an entry from cache.

strategyName

Returns the name of the current strategy

Static Methods

initialize

Initialize from settings.

instance

Returns the current instance.

Signals

projectRemovedFromCache

Emitted whenever a project is removed from the cache.

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(path: str)[source]

Emitted whenever a project is removed from the cache.

Added in version 3.38.

Parameters:

path (str)

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