class AdaptiveCache

Properties

bool read-only $enabled

Whether the adaptive cache is enabled for this Relay object.

string read-only $status

The actual state of the adaptive cache. The user can request an adaptive cache of a certain width and depth, but it is not actually created until Relay attaches to an in-memory endpoint. This can fail if we are out of memory. This property will be either 'inactive' or 'active'.

int read-only $width

The underlying count-min sketch width.

int read-only $depth

The underlying count-min sketch depth.

int read-only $minEvents

Number of events (reads + writes) a key needs before minRatio is applied.

float read-only $minRatio

Minimum read/write ratio before a key is cached.

string read-only $formula

The adaptive cache formula (pure, scaled).

Methods

__construct()

No description

float|false
loadFactor(int $depth = 1)

Returns the estimated load factor of the count-min sketch as a percentage (0-100), or 0.0 when the adaptive cache is inactive.

bool
flush(bool $async = true)

Flush the adaptive cache.

array|false
stats(string $key)

Returns the estimated read and write counts for the given key, or false when the adaptive cache is inactive.

bool
incrBy(string $key, bool $write, int $count = 1)

Increment a key's read or write counter by given count.

float
lastFlush()

Get the last time the adaptive cache was flushed.

Details

at line 79
protected __construct()

internal  
 

No description

at line 91
float|false loadFactor(int $depth = 1)

Returns the estimated load factor of the count-min sketch as a percentage (0-100), or 0.0 when the adaptive cache is inactive.

Only the first $depth rows of the sketch are considered; a value below 1 or above the sketch's depth considers all of them.

Parameters

int $depth

Return Value

float|false

at line 100
bool flush(bool $async = true)

Flush the adaptive cache.

Parameters

bool $async

Return Value

bool

at line 110
array|false stats(string $key)

Returns the estimated read and write counts for the given key, or false when the adaptive cache is inactive.

Parameters

string $key

Return Value

array|false

at line 121
bool incrBy(string $key, bool $write, int $count = 1)

Increment a key's read or write counter by given count.

Parameters

string $key
bool $write
int $count

Return Value

bool

at line 129
float lastFlush()

Get the last time the adaptive cache was flushed.

Return Value

float