\JSONDB\Cache

Class Cache

Summary

Properties

$database

$database : \JSONDB\Database
Description Database class instance
Type \JSONDB\Database

$cache

$cache : array
Description Cache array
Type array

Methods

__construct()

__construct(\JSONDB\Database  $db)

Cache __constructor.

Parameters
\JSONDB\Database $db Database instance to use with Cache

setDatabase()

setDatabase(\JSONDB\Database  $database) : \JSONDB\Cache

Changes the Database instance used.

Parameters
\JSONDB\Database $database Database class instance
Returns

\JSONDB\Cache

get()

get(array|string  $path) : array|mixed

Calculates the memory usage of a benchmark point.

Parameters
array|string $path The path (or an array of paths) to the table (or tables)
Returns

array|mixed

update()

update(string  $path, array|null  $data = NULL) : array

Updates the cached data for a table.

Parameters
string $path The path to the table
array|null $data The data to cache for the given table
Returns

array

reset()

reset() : \JSONDB\Cache

Resets the cache.

Returns

\JSONDB\Cache