jKVDriver
in package
Table of Contents
- $_connection : object|resource
- Name of the driver.
- $_driverName : string
- Name of the driver.
- $_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.
- _connect() : mixed
- _disconnect() : mixed
- isResource() : mixed
Properties
$_connection
Name of the driver.
protected
object|resource
$_connection
$_driverName
Name of the driver.
protected
string
$_driverName
$_profile
Profile for the connection in the kvdb INIfile.
protected
array<string|int, mixed>
$_profile
$_profileName
name of the profile.
protected
string
$_profileName
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
abstract 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
abstract 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
abstract delete(string $key) : bool
Parameters
- $key : string
-
the key
Return values
bool —false if failure
flush()
Flush the KVDb. Deletes all keys.
public
abstract flush() : bool
Return values
bool —true if it is a success
get()
Gets one or several values;.
public
abstract 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
abstract 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
abstract 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
abstract 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
abstract 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
abstract 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...
_connect()
protected
abstract _connect() : mixed
Return values
mixed —_disconnect()
protected
abstract _disconnect() : mixed
Return values
mixed —isResource()
protected
isResource(mixed $value) : mixed
Parameters
- $value : mixed