PortaBilling API

FileCache
in package
implements CacheInterface

Simple PSR-16 cache implementation with file storage

It's very simple implementation of PSR-16 to avoid unused dependencies in a case you need just store persistent billing session in low load environment.

It is quite specific to the library requirements and not recommended to be used to store something else but session data.

The library takes session data from cache on each request, and may generate series of sequential operations like has() -> $get() so this class will cache read current content for a small time, but will write immediately. This match the usage pattern and then this cache implementation is specific.

Interfaces, Classes, Traits and Enums

CacheInterface

Table of Contents

__construct()  : mixed
Setup the file-based cache object

Methods

__construct()

Setup the file-based cache object

public __construct(string $filename, int $memoryCacheTime) : mixed
Parameters
$filename : string

filename to be used for persistent storage

$memoryCacheTime : int

time in milliseconds (1/1M of second) to use data after read from file before re-read it.

Only purpose of this to save on file read at sequence call like ->has() and then ->get(), therefore always set it very low.

Setting to zero (default) force to read from file each call of has(), get(), e.t.c.

Return values
mixed

Search results