Documentation

Cache extends Singleton
in package

Class for caching data on disk.

For now we use one cache file for all pages of the service. Cache drops each hour.

Tags
author

Dodonov A.A.

Table of Contents

$cachePath  : string
Cache file path
$data  : string
Cache data
$instances  : array<string, object>
Created instances of different objects
__clone()  : mixed
Cloner
__construct()  : mixed
Constructor
destroy()  : void
Destroy object
exists()  : bool
Checking cache for data
flush()  : mixed
Method flushes data on disk
get()  : mixed
Method gets data from cache
getInstance()  : object
Function returns instance of the object
set()  : mixed
Method adds data to cache
fileGetContents()  : string
Fetching cache data
filePutContents()  : void
Method stores data on disk
init()  : mixed
Method inits cache

Properties

$cachePath

Cache file path

protected string $cachePath = './cache/'

$data

Cache data

protected string $data = null

$instances

Created instances of different objects

private static array<string, object> $instances

Methods

__clone()

Cloner

public __clone() : mixed
Return values
mixed

__construct()

Constructor

public __construct() : mixed
Return values
mixed

destroy()

Destroy object

public destroy() : void
Return values
void

exists()

Checking cache for data

public exists(string $key) : bool
Parameters
$key : string

Data key

Return values
bool

True if the data was found, false otherwise

flush()

Method flushes data on disk

public flush() : mixed
Return values
mixed

get()

Method gets data from cache

public get(string $key) : mixed
Parameters
$key : string

Key of the requested data

Return values
mixed

Data from cache

getInstance()

Function returns instance of the object

public static getInstance() : object
Return values
object

stored object

set()

Method adds data to cache

public set(string $key, mixed $data) : mixed
Parameters
$key : string

Key

$data : mixed

Data to be stored in cache

Return values
mixed

fileGetContents()

Fetching cache data

protected fileGetContents(string $filePath) : string
Parameters
$filePath : string

path to cache file

Tags
codeCoverageIgnore
Return values
string

cache file content

filePutContents()

Method stores data on disk

protected filePutContents(string $path, string $content) : void
Parameters
$path : string
$content : string
Tags
codeCoverageIgnore
Return values
void

init()

Method inits cache

protected init() : mixed
Return values
mixed

Search results