ProjectCache
in package
Table of Contents
Constants
- CACHE_FORMAT_VERSION = 12
- 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
- Modification time of the lizmap configuration file for the QGIS project.
- $qgsMtime : int
- Modification time of the QGIS project file.
Methods
- __construct() : mixed
- Initialize the cache of a Qgis project.
- clearCache() : mixed
- Erase the project data from the cache.
- getCfgFileTime() : int
- Get modification time of the lizmap configuration file for the QGIS project.
- getEditableLayerFormCache() : array<string|int, QgisFormControlProperties>
- Read the form properties of the corresponding editable layer.
- getFileTime() : int
- Get modification time of the lQGIS project file.
- 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() : bool
- 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
= 12
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
Modification time of the lizmap configuration file for the QGIS project.
protected
int
$qgsCfgMtime
= 0
$qgsMtime
Modification time of the QGIS project file.
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 QGIS project 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()
Get modification time of the lizmap configuration file for the QGIS project.
public
getCfgFileTime() : int
Return values
intgetEditableLayerFormCache()
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()
Get modification time of the lQGIS project file.
public
getFileTime() : int
Return values
intgetProjectRelatedDataCache()
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) : bool
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>
Return values
bool —false if failure
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