Pepperminty Wiki Module API

StorageBox
in package

Represents a key-value data store.

Table of Contents

MODE_ARR_SIMPLE  = 1
MODE_JSON  = 0
__construct()  : mixed
Initialises a new store connection.
clear()  : void
Empties the store.
close()  : void
Syncs changes to disk and closes the PDO connection.
delete()  : bool
Deletes an item from the data store.
get()  : mixed
Gets a value from the store.
get_arr_simple()  : mixed
get_keys()  : PDOStatement
Returns an iterable that returns all the keys that do not contain the given string.
has()  : bool
Determines if the given key exists in the store or not.
set()  : void
Sets a value in the data store.
set_arr_simple()  : void

Constants

Methods

__construct()

Initialises a new store connection.

public __construct(string $filename) : mixed
Parameters
$filename : string

The filename that the store is located in.

Return values
mixed

clear()

Empties the store.

public clear() : void
Return values
void

close()

Syncs changes to disk and closes the PDO connection.

public close() : void
Return values
void

delete()

Deletes an item from the data store.

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

The key of the item to delete.

Return values
bool

Whether it was really deleted or not. Note that if it doesn't exist, then it can't be deleted.

get()

Gets a value from the store.

public get(string $key) : mixed
Parameters
$key : string

The key value is stored under.

Return values
mixed

The stored value.

get_arr_simple()

public get_arr_simple(string $key[, string $delimiter = "|" ]) : mixed
Parameters
$key : string
$delimiter : string = "|"
Return values
mixed

get_keys()

Returns an iterable that returns all the keys that do not contain the given string.

public get_keys(string $exclude) : PDOStatement
Parameters
$exclude : string

The string to search for when excluding keys.

Return values
PDOStatement

The iterable. Use a foreach loop on it.

has()

Determines if the given key exists in the store or not.

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

The key to test.

Return values
bool

Whether the key exists in the store or not.

set()

Sets a value in the data store.

public set(string $key, mixed $value) : void

Note that this does NOT save changes to disk until you close the connection!

Parameters
$key : string

The key to set the value of.

$value : mixed

The value to store.

Return values
void

set_arr_simple()

public set_arr_simple(string $key, mixed $value[, string $delimiter = "|" ]) : void
Parameters
$key : string
$value : mixed
$delimiter : string = "|"
Return values
void

Search results