Horde_Prefs_Storage_Mongo
extends Horde_Prefs_Storage_Base
in package
implements
Horde_Mongo_Collection_Index
Preferences storage implementation for a MongoDB database.
Tags
Interfaces, Classes, Traits and Enums
- Horde_Mongo_Collection_Index
Table of Contents
- NAME = 'name'
- SCOPE = 'scope'
- UID = 'uid'
- VALUE = 'value'
- $_db : MongoCollection
- The MongoDB Collection object for the cache data.
- $_indices : array<string|int, mixed>
- Indices list.
- $_params : string
- Configuration parameters.
- __construct() : mixed
- Constructor.
- checkMongoIndices() : mixed
- createMongoIndices() : mixed
- get() : Horde_Prefs_Scope
- Retrieves the requested preferences scope from the storage backend.
- getParams() : array<string|int, mixed>
- Get the list of driver parameters.
- listScopes() : array<string|int, mixed>
- Lists all available scopes.
- onChange() : mixed
- Called whenever a preference value is changed.
- remove() : mixed
- Removes preferences from the backend.
- store() : mixed
- Stores changed preferences in the storage backend.
Constants
NAME
public
mixed
NAME
= 'name'
SCOPE
public
mixed
SCOPE
= 'scope'
UID
public
mixed
UID
= 'uid'
VALUE
public
mixed
VALUE
= 'value'
Properties
$_db
The MongoDB Collection object for the cache data.
protected
MongoCollection
$_db
$_indices
Indices list.
protected
array<string|int, mixed>
$_indices
= array('index_scope' => array(self::SCOPE => 1), 'index_uid' => array(self::UID => 1))
$_params
Configuration parameters.
protected
string
$_params
= array()
'user' is always available as an entry.
Methods
__construct()
Constructor.
public
__construct(string $user[, array<string|int, mixed> $params = array() ]) : mixed
Parameters
- $user : string
-
The username.
- $params : array<string|int, mixed> = array()
-
Configuration parameters.
- collection: (string) The collection name. - mongo_db: (Horde_Mongo_Client) [REQUIRED] A MongoDB client object.
Return values
mixed —checkMongoIndices()
public
checkMongoIndices() : mixed
Return values
mixed —createMongoIndices()
public
createMongoIndices() : mixed
Return values
mixed —get()
Retrieves the requested preferences scope from the storage backend.
public
get(mixed $scope_ob) : Horde_Prefs_Scope
Parameters
- $scope_ob : mixed
-
The scope object.
Return values
Horde_Prefs_Scope —The modified scope object.
getParams()
Get the list of driver parameters.
public
getParams() : array<string|int, mixed>
Return values
array<string|int, mixed> —Driver parameters.
listScopes()
Lists all available scopes.
public
listScopes() : array<string|int, mixed>
Return values
array<string|int, mixed> —The list of scopes stored in the backend.
onChange()
Called whenever a preference value is changed.
public
onChange(string $scope, string $pref) : mixed
Parameters
- $scope : string
-
Scope specifier.
- $pref : string
-
The preference name.
Return values
mixed —remove()
Removes preferences from the backend.
public
remove([mixed $scope = null ][, mixed $pref = null ]) : mixed
Parameters
- $scope : mixed = null
-
The scope of the prefs to clear. If null, clears all scopes.
- $pref : mixed = null
-
The pref to clear. If null, clears the entire scope.
Return values
mixed —store()
Stores changed preferences in the storage backend.
public
store(mixed $scope_ob) : mixed
Parameters
- $scope_ob : mixed
-
The scope object.