class FileStorage implements IStorage

Cache file storage.

Traits

Strict class for better experience.

Constants

META_HEADER_LEN

META_TIME

META_SERIALIZED

META_EXPIRE

META_DELTA

META_ITEMS

META_CALLBACKS

FILE

additional cache structure

HANDLE

additional cache structure

Properties

static float $gcProbability
static $useDirectories

Methods

__construct(string $dir, IJournal $journal = null)

No description

mixed
read(string $key)

Read from cache.

void
lock(string $key)

Prevents item reading and writing. Lock is released by write() or remove().

void
write(string $key, $data, array $dp)

Writes item into the cache.

void
remove(string $key)

Removes item from the cache.

void
clean(array $conditions)

Removes items from the cache by conditions.

array|null
readMetaAndLock(string $file, int $lock)

Reads cache data from disk.

mixed
readData(array $meta)

Reads cache data from disk and closes cache file handle.

string
getCacheFile(string $key)

Returns file name.

Details

at line 66
__construct(string $dir, IJournal $journal = null)

Parameters

string $dir
IJournal $journal

at line 81
mixed read(string $key)

Read from cache.

Parameters

string $key

Return Value

mixed

at line 131
void lock(string $key)

Prevents item reading and writing. Lock is released by write() or remove().

Parameters

string $key

Return Value

void

at line 145
void write(string $key, $data, array $dp)

Writes item into the cache.

Parameters

string $key
$data
array $dp

Return Value

void

at line 224
void remove(string $key)

Removes item from the cache.

Parameters

string $key

Return Value

void

at line 231
void clean(array $conditions)

Removes items from the cache by conditions.

Parameters

array $conditions

Return Value

void

at line 296
protected array|null readMetaAndLock(string $file, int $lock)

Reads cache data from disk.

Parameters

string $file
int $lock

Return Value

array|null

at line 324
protected mixed readData(array $meta)

Reads cache data from disk and closes cache file handle.

Parameters

array $meta

Return Value

mixed

at line 341
protected string getCacheFile(string $key)

Returns file name.

Parameters

string $key

Return Value

string