PHP Class Webiny\Component\Rest\Compiler\Cache

显示文件 Open project: Webiny/Framework Class Usage Examples

Public Methods

Method Description
__construct ( Webiny\Component\Rest\Compiler\CacheDrivers\CacheDriverInterface $cacheDriver ) Base constructor.
deleteCache ( $api, $class )
getCacheContent ( $api, $class, $version ) : array Returns the contents of an existing cache file in form of an array.
isCacheValid ( string $api, string $class ) : boolean Checks if a cache file is valid.
writeCacheFile ( $api, $class, $version, $cacheArray ) Save the compiled cache array.

Method Details

__construct() public method

Base constructor.
public __construct ( Webiny\Component\Rest\Compiler\CacheDrivers\CacheDriverInterface $cacheDriver )
$cacheDriver Webiny\Component\Rest\Compiler\CacheDrivers\CacheDriverInterface

deleteCache() public method

public deleteCache ( $api, $class )
$api Name of the API.
$class Name of the class.

getCacheContent() public method

Returns the contents of an existing cache file in form of an array.
public getCacheContent ( $api, $class, $version ) : array
$api Name of the API.
$class Name of the class.
$version Version of the class.
return array

isCacheValid() public method

A valid file is considered and existing cache file that has a newer creation time, than the modify time, of an api class that the cache file belongs to.
public isCacheValid ( string $api, string $class ) : boolean
$api string Name of the rest api configuration.
$class string Fully qualified class name.
return boolean True if cache file is valid, otherwise false.

writeCacheFile() public method

Save the compiled cache array.
public writeCacheFile ( $api, $class, $version, $cacheArray )
$api Name of the API.
$class Name of the class.
$version Version of the class.
$cacheArray The compiled class cache array.