CloudDataSource
extends AbstractDataSource
in package
Uses
UtilsProvider
Load templates from cloud API, but not every time when consumer should be invalidated. In case of e.g. recalculations of middlewares, load the `before_middleware` value from database instead of API fetch.
Table of Contents
Constants
- OPTION_NAME_LATEST_RESPONSE_RELEASE_INFO_PREFIX = RCB_OPT_PREFIX . '-cloud-data-source-release-info-'
- PER_PAGE = 100
- RETRY_IN_SECONDS_WHEN_ASYNC_RESPONSE = 3
- RETRY_IN_SECONDS_WHEN_DOWNLOAD_FAILED = 60 * 5
- VARIABLE_NAME_FAILED_DOWNLOAD_RETRY_IN = 'CloudDataSource.failedDownloadRetryIn'
Properties
- $consumer : mixed
- $data : mixed
- $latestResponseMetadata : mixed
Methods
- __construct() : mixed
- C'tor.
- allowAsyncCacheCalculation() : mixed
- Allow async cache calculation in cloud backend only when we already have templates.
- clearData() : mixed
- Clear all available data.
- getConsumer() : mixed
- Getter.
- getData() : mixed
- Getter.
- getPluginConstantPrefix() : string
- Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
- retrieve() : array<string|int, AbstractTemplate>
- Retrieve all templates from data source (e.g. request to service cloud).
- setData() : mixed
- Set data which could be reused by middlewares.
- shouldFetchFromApi() : mixed
- Check if this data source should read from database or external cloud API.
- getApiLanguage() : mixed
- Get the language which is requested by the cloud API.
- getLicense() : mixed
- Get current license.
- getStorageHelper() : StorageHelper
- Getter.
- loadFromApi() : mixed
- Load all templates from service cloud.
- loadFromDatabase() : mixed
- Load `before_middleware` from database instead of API request.
Constants
OPTION_NAME_LATEST_RESPONSE_RELEASE_INFO_PREFIX
public
mixed
OPTION_NAME_LATEST_RESPONSE_RELEASE_INFO_PREFIX
= RCB_OPT_PREFIX . '-cloud-data-source-release-info-'
PER_PAGE
public
mixed
PER_PAGE
= 100
RETRY_IN_SECONDS_WHEN_ASYNC_RESPONSE
public
mixed
RETRY_IN_SECONDS_WHEN_ASYNC_RESPONSE
= 3
RETRY_IN_SECONDS_WHEN_DOWNLOAD_FAILED
public
mixed
RETRY_IN_SECONDS_WHEN_DOWNLOAD_FAILED
= 60 * 5
VARIABLE_NAME_FAILED_DOWNLOAD_RETRY_IN
public
mixed
VARIABLE_NAME_FAILED_DOWNLOAD_RETRY_IN
= 'CloudDataSource.failedDownloadRetryIn'
Properties
$consumer
private
mixed
$consumer
$data
private
mixed
$data
$latestResponseMetadata
private
mixed
$latestResponseMetadata
Methods
__construct()
C'tor.
public
__construct(ServiceCloudConsumer $consumer) : mixed
Parameters
- $consumer : ServiceCloudConsumer
allowAsyncCacheCalculation()
Allow async cache calculation in cloud backend only when we already have templates.
public
allowAsyncCacheCalculation() : mixed
This method returns true, when at least one cloud template is already in our database.
clearData()
Clear all available data.
public
clearData() : mixed
Tags
getConsumer()
Getter.
public
getConsumer() : mixed
Tags
getData()
Getter.
public
getData(string $key) : mixed
Parameters
- $key : string
Tags
getPluginConstantPrefix()
Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
public
getPluginConstantPrefix() : string
Tags
Return values
stringretrieve()
Retrieve all templates from data source (e.g. request to service cloud).
public
retrieve() : array<string|int, AbstractTemplate>
Return values
array<string|int, AbstractTemplate>setData()
Set data which could be reused by middlewares.
public
setData(string $key, mixed $value) : mixed
Parameters
- $key : string
- $value : mixed
Tags
shouldFetchFromApi()
Check if this data source should read from database or external cloud API.
public
shouldFetchFromApi() : mixed
getApiLanguage()
Get the language which is requested by the cloud API.
protected
getApiLanguage() : mixed
getLicense()
Get current license.
protected
getLicense() : mixed
getStorageHelper()
Getter.
protected
getStorageHelper() : StorageHelper
Return values
StorageHelperloadFromApi()
Load all templates from service cloud.
protected
loadFromApi([array<string|int, AbstractTemplate> &$result = null ][, string $cursor = 'id:0' ]) : mixed
Parameters
- $result : array<string|int, AbstractTemplate> = null
- $cursor : string = 'id:0'
Tags
loadFromDatabase()
Load `before_middleware` from database instead of API request.
protected
loadFromDatabase() : mixed