Pepperminty Wiki Module API

JsonStorageBox
in package

Represents a key-value data store.

Tags
license

Apache 2.0

Table of Contents

__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.
has()  : bool
Determines if the given key exists in the store or not.
set()  : void
Sets a value in the data store.

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. Note also that if a node is deleted before being persisted to disk, this will return false when in actuality it was deleted successfully.

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.

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

Search results