General Persistence Slot methods
Methods used to create, set up and destroy slots.
opensrf.persist.slot.create( slot_name )
Creates a Persistence Slot.
slot_name (optional)
The name of the Persistence Slot to create. If a name is not specified
then the Slot is given a generic, unique name. Automatically named Slots
are destroyed as soon as they are empty.
Success
The name of the Slot that was created.
Failure
An empty (NULL) result.
opensrf.persist.slot.create_expirable( slot_name, expire_interval )
Creates a Persistence Slot that is automatically destroyed after the specified interval.
slot_name
The name of the Persistence Slot to create.
expire_interval
An interval describing how long to wait after an access has
occured on the Slot before automatically destroying it. The interval
can be specified using a fairly complex, human readable format, or as
a number of seconds. For example:
- 1 day, 2 hours and 35 minutes
- +2h
- 1 week
- 300
A setting of 0 (zero) disables automatic expiration for a Slot.
Success
The name of the Slot that was created.
Failure
An empty (NULL) result.
opensrf.persist.slot.set_expire( slot_name, expire_interval )
Sets or disables the expiration interval on an existing Persistence Slot.
slot_name
The name of the Persistence Slot to update.
expire_interval
An interval describing how long to wait after an access has
occured on the Slot before automatically destroying it. The interval
can be specified using a fairly complex, human readable format, or as
a number of seconds. For example:
- 1 day, 2 hours and 35 minutes
- +2h
- 1 week
- 300
A setting of 0 (zero) disables automatic expiration for a Slot.
Success
The number of seconds the requested interval represents.
Failure
An empty (NULL) result.
opensrf.persist.slot.destroy( slot_name )
Destroys a Persistence Slot.
slot_name
The name of the Persistence Slot to destroy.
Success
The name of the Slot that was destroyed.
Failure
An empty (NULL) result.
QUEUE API-Namespace Slot methods
Uses the Slot in FIFO mode, pushing values onto one end an pulling them off the other.
The QUEUE API-Namespace is useful for creating an ordered message passing access point.
opensrf.persist.queue.push( slot_name, object )
Adds an object to a Slot in FIFO order.
slot_name
The name of the Persistence Slot to use for storing the object.
object
The object that should be pushed onto the front of the QUEUE.
Success
The name of the Slot that was used.
Failure
An empty (NULL) result.
opensrf.persist.queue.pop( slot_name )
Removes and returns the next value in a QUEUE type Slot.
slot_name
The name of the Persistence Slot from which an object should be retrieved.
Success
The next object on the QUEUE Slot, or an empty
(NULL) result if the Slot is empty.
Failure
An empty (NULL) result.
opensrf.persist.queue.peek( slot_name )
Returns the next value in a QUEUE type Slot
without removing it.
slot_name
The name of the Persistence Slot from which an object should be retrieved.
Success
The next object on the QUEUE Slot, or an empty
(NULL) result if the Slot is empty.
Failure
An empty (NULL) result.
opensrf.persist.queue.peek.all( slot_name )
Returns all values in a QUEUE type Slot
without removing them.
slot_name
The name of the Persistence Slot from which the objects should be retrieved.
Success
A stream of all objects on the QUEUE Slot, or an empty
(NULL) result if the Slot is empty.
Failure
An empty (NULL) result.
opensrf.persist.queue.peek.all.atomic( slot_name )
Returns all values in a QUEUE type Slot
without removing them.
slot_name
The name of the Persistence Slot from which the objects should be retrieved.
Success
A single array of all objects on the QUEUE Slot, or an empty
array if the Slot is empty.
Failure
An empty (NULL) result.
opensrf.persist.queue.length( slot_name )
Returns the number of objects in the QUEUE type Slot.
slot_name
The name of the Persistence Slot in question.
Success
The number of objects in the Persistence Slot.
Failure
An empty (NULL) result.
opensrf.persist.queue.size( slot_name )
Returns the number bytes taken up by the JSON encoded version of
the objects in the QUEUE type Slot.
slot_name
The name of the Persistence Slot in question.
Success
The space, in bytes, used by the JSON encoded
objects in the Persistence Slot.
Failure
An empty (NULL) result.
STACK style Slot methods
Uses the Slot in FILO mode, pushing and pulling objects at the same end of a list.
The STACK API-Namespace is useful for creating a global Application context stack.
opensrf.persist.stack.push( slot_name, object )
Adds an object to a Slot in FILO order.
slot_name
The name of the Persistence Slot to use for storing the object.
object
The object that should be pushed onto the front of the STACK.
Success
The name of the Slot that was used.
Failure
An empty (NULL) result.
opensrf.persist.stack.pop( slot_name )
Removes and returns the next value in a STACK type Slot.
slot_name
The name of the Persistence Slot from which an object should be retrieved.
Success
The next object on the STACK Slot, or an empty
(NULL) result if the Slot is empty.
Failure
An empty (NULL) result.
opensrf.persist.stack.peek( slot_name )
Returns the next value in a STACK type Slot
without removing it.
slot_name
The name of the Persistence Slot from which an object should be retrieved.
Success
The next object on the STACK Slot, or an empty
(NULL) result if the Slot is empty.
Failure
An empty (NULL) result.
opensrf.persist.stack.peek.all( slot_name )
Returns all values in a STACK type Slot
without removing them.
slot_name
The name of the Persistence Slot from which the objects should be retrieved.
Success
A stream of all objects on the STACK Slot, or an empty
(NULL) result if the Slot is empty.
Failure
An empty (NULL) result.
opensrf.persist.stack.peek.all.atomic( slot_name )
Returns all values in a STACK type Slot
without removing them.
slot_name
The name of the Persistence Slot from which the objects should be retrieved.
Success
A single array of all objects on the STACK Slot, or an empty
array if the Slot is empty.
Failure
An empty (NULL) result.
opensrf.persist.stack.depth( slot_name )
Returns the number of objects in the STACK type Slot.
slot_name
The name of the Persistence Slot in question.
Success
The number of objects in the Persistence Slot.
Failure
An empty (NULL) result.
opensrf.persist.stack.size( slot_name )
Returns the number bytes taken up by the JSON encoded version of
the objects in the STACK type Slot.
slot_name
The name of the Persistence Slot in question.
Success
The space, in bytes, used by the JSON encoded
objects in the Persistence Slot.
Failure
An empty (NULL) result.
OBJECT style Slot methods
Uses the Slot in Single Object mode, storing a single object in the Slot.
The OBJECT API-Namespace is useful for globally caching unique objects.
opensrf.persist.object.set( slot_name, object )
Sets the value of a Slot. If the Slot has been used in STACK or QUEUE
mode and
opensrf.persist.object.set is called then all objects currently
in the Slot will be lost.
slot_name
The name of the Persistence Slot to use for storing the object.
object
The object that should be set as the one object in the Slot.
Success
The name of the Slot that was used.
Failure
An empty (NULL) result.
opensrf.persist.object.get( slot_name )
Removes and returns the value in an OBJECT type Slot.
slot_name
The name of the Persistence Slot from which the object should be retrieved.
Success
The object in the OBJECT Slot, or an empty
(NULL) result if the Slot is empty.
Failure
An empty (NULL) result.
opensrf.persist.object.peek( slot_name )
Returns the value in an OBJECT type Slot
without removing it.
slot_name
The name of the Persistence Slot from which the object should be retrieved.
Success
The object on the OBJECT Slot, or an empty
(NULL) result if the Slot is empty.
Failure
An empty (NULL) result.
opensrf.persist.object.size( slot_name )
Returns the number bytes taken up by the JSON encoded version of
the object in the OBJECT type Slot.
slot_name
The name of the Persistence Slot in question.
Success
The space, in bytes, used by the JSON encoded
object in the Persistence Slot.
Failure
An empty (NULL) result.