ProjectCache
in package
Table of Contents
Constants
- CACHE_FORMAT_VERSION = 10
- version of the format of data stored in the cache.
Properties
- $appContext : AppContextInterface
- $file : string
- The path of the project file.
- $fileKey : string
- The key to access data in the cache.
- $profile : string
- The Cache profile.
- $qgsCfgMtime : int
- $qgsMtime : int
Methods
- __construct() : mixed
- Initialize the cache of a Qgis project.
- clearCache() : mixed
- Erase the project data from the cache.
- getCfgFileTime() : mixed
- getEditableLayerFormCache() : array<string|int, QgisFormControlProperties>
- Read the form properties of the corresponding editable layer.
- getFileTime() : mixed
- getProjectRelatedDataCache() : false|mixed
- Read some data from the project cache, related to the project.
- retrieveProjectData() : array<string|int, mixed>|bool
- Returns the Project data stored in Cache.
- setEditableLayerFormCache() : mixed
- Stores form properties from an editable Layer into cache.
- setProjectRelatedDataCache() : bool
- store some data into the project cache, related to the project.
- storeProjectData() : mixed
- Store project Data in Cache.
Constants
CACHE_FORMAT_VERSION
version of the format of data stored in the cache.
public
mixed
CACHE_FORMAT_VERSION
= 10
This number should be increased each time you change the structure of the properties of QgisProject or the content of QgisFormControlProperties (ex: adding some new data properties into the $layers). So you'll be sure that the cache will be updated when Lizmap code source is updated on a server
Properties
$appContext
protected
AppContextInterface
$appContext
$file
The path of the project file.
protected
string
$file
$fileKey
The key to access data in the cache.
protected
string
$fileKey
$profile
The Cache profile.
protected
string
$profile
= 'qgisprojects'
$qgsCfgMtime
protected
int
$qgsCfgMtime
= 0
$qgsMtime
protected
int
$qgsMtime
= 0
Methods
__construct()
Initialize the cache of a Qgis project.
public
__construct(string $file, int $modifiedTime, int $cfgModifiedTime, AppContextInterface $appContext) : mixed
The given Qgis file should exist, as well as the corresponding lizmap cfg file.
Parameters
- $file : string
-
The full path of the QGIS project file
- $modifiedTime : int
-
Modification time of the file
- $cfgModifiedTime : int
-
Modification time of the lizmap configuration file for the QGIS project
- $appContext : AppContextInterface
-
The interface to call Jelix
clearCache()
Erase the project data from the cache.
public
clearCache() : mixed
getCfgFileTime()
public
getCfgFileTime() : mixed
getEditableLayerFormCache()
Read the form properties of the corresponding editable layer.
public
getEditableLayerFormCache(string $layerId) : array<string|int, QgisFormControlProperties>
Is assumes that the cache exists, as it should be created during the first project parsing.
Parameters
- $layerId : string
Tags
Return values
array<string|int, QgisFormControlProperties>getFileTime()
public
getFileTime() : mixed
getProjectRelatedDataCache()
Read some data from the project cache, related to the project.
public
getProjectRelatedDataCache(string $key) : false|mixed
It checks if the cache is belong with the current project cache.
Parameters
- $key : string
Return values
false|mixed —false if there is no cache, else the data
retrieveProjectData()
Returns the Project data stored in Cache.
public
retrieveProjectData() : array<string|int, mixed>|bool
Return values
array<string|int, mixed>|boolsetEditableLayerFormCache()
Stores form properties from an editable Layer into cache.
public
setEditableLayerFormCache(string $layerId, array<string|int, QgisFormControlProperties> $formControls) : mixed
It should be called during the read of the project, before the project properties are stored into the cache. as the getEditableLayerFormCache method does not check the validity of the cache.
Parameters
- $layerId : string
- $formControls : array<string|int, QgisFormControlProperties>
setProjectRelatedDataCache()
store some data into the project cache, related to the project.
public
setProjectRelatedDataCache(string $key, mixed $data[, mixed $ttl = 7200 ]) : bool
Parameters
- $key : string
- $data : mixed
- $ttl : mixed = 7200
Return values
bool —false if failure
storeProjectData()
Store project Data in Cache.
public
storeProjectData(array<string|int, mixed> $data) : mixed
Parameters
- $data : array<string|int, mixed>
-
The datas to store