Jelix 1.7.18

dbaKVDriver extends jKVDriver
in package
implements jIKVPersistent

Tags
subpackage

kvdb_plugin

author

Laurent Jouanneau

copyright

2012-2021 Laurent Jouanneau

licence

http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file

Interfaces, Classes and Traits

jIKVPersistent
interface for KV driver which store values in a persistent manner (in a file...).

Table of Contents

$_connection  : object|resource
Name of the driver.
$_driverName  : string
Name of the driver.
$_file  : mixed
$_profile  : array<string|int, mixed>
Profile for the connection in the kvdb INIfile.
$_profileName  : string
name of the profile.
__construct()  : mixed
Class constructor.
__destruct()  : mixed
Class destructor.
append()  : string
append a string to an existing key value.
decrement()  : int
decrement a value by $decr. the key should exist and should be an integer.
delete()  : bool
Deletes a key from the KVdb.
flush()  : bool
Flush the KVDb. Deletes all keys.
get()  : string
Gets one or several values;.
increment()  : int
increment a value by $incr. the key should exist and should be an integer.
insert()  : bool
Store a key/value. If the key already exist : error.
prepend()  : string
prepend a string to an existing key value.
replace()  : bool
Store a key/value. The key should exists.
set()  : bool
Store a key/value.
sync()  : mixed
synchronize the memory content with the persistent storage.
_connect()  : mixed
_disconnect()  : mixed
isResource()  : mixed

Properties

$_connection

Name of the driver.

protected object|resource $_connection

$_profile

Profile for the connection in the kvdb INIfile.

protected array<string|int, mixed> $_profile

Methods

__construct()

Class constructor.

public __construct(array<string|int, mixed> $profile) : mixed

Initialise profile data and create the main object

Parameters
$profile : array<string|int, mixed>
Return values
mixed

__destruct()

Class destructor.

public __destruct() : mixed
Return values
mixed

append()

append a string to an existing key value.

public append(string $key, string $value) : string
Parameters
$key : string

the key of the value to modify

$value : string

the value to append to the current key value

Return values
string

the new value or false if failure

decrement()

decrement a value by $decr. the key should exist and should be an integer.

public decrement(string $key[, mixed $decr = 1 ]) : int
Parameters
$key : string

the key of the value

$decr : mixed = 1

the value to substract to the current value

Return values
int

the result, or false if failure

delete()

Deletes a key from the KVdb.

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

the key

Return values
bool

false if failure

flush()

Flush the KVDb. Deletes all keys.

public flush() : bool
Return values
bool

true if it is a success

get()

Gets one or several values;.

public get(array<string|int, mixed>|string $key) : string
Parameters
$key : array<string|int, mixed>|string

a key or an array of keys

Return values
string

or null if the key doesn't exist

increment()

increment a value by $incr. the key should exist and should be an integer.

public increment(string $key[, mixed $incr = 1 ]) : int
Parameters
$key : string

the key of the value

$incr : mixed = 1

the value to add to the current value

Return values
int

the result, or false if failure

insert()

Store a key/value. If the key already exist : error.

public insert(string $key, string $value) : bool
Parameters
$key : string

the key

$value : string
Return values
bool

false if failure

prepend()

prepend a string to an existing key value.

public prepend(string $key, string $value) : string
Parameters
$key : string

the key of the value to modify

$value : string

the value to prepend to the current key value

Return values
string

the new value or false if failure

replace()

Store a key/value. The key should exists.

public replace(string $key, string $value) : bool
Parameters
$key : string

the key

$value : string
Return values
bool

false if failure

set()

Store a key/value.

public set(string $key, string $value) : bool
Parameters
$key : string

the key

$value : string
Return values
bool

false if failure, if the value is a resource...

sync()

synchronize the memory content with the persistent storage.

public sync() : mixed
Return values
mixed

_connect()

protected _connect() : mixed
Return values
mixed

_disconnect()

protected _disconnect() : mixed
Return values
mixed

isResource()

protected isResource(mixed $value) : mixed
Parameters
$value : mixed
Return values
mixed

Search results