[[user-comments:osrf-devel:persist-stacks|User Comments]] **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. * **Parameters:** * //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. * **Returns:** * //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. * **Parameters:** * //slot_name//\\ The name of the Persistence Slot from which an object should be retrieved. * **Returns:** * //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. * **Parameters:** * //slot_name//\\ The name of the Persistence Slot from which an object should be retrieved. * **Returns:** * //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. * **Parameters:** * //slot_name//\\ The name of the Persistence Slot from which the objects should be retrieved. * **Returns:** * //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. * **Parameters:** * //slot_name//\\ The name of the Persistence Slot from which the objects should be retrieved. * **Returns:** * //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. * **Parameters:** * //slot_name//\\ The name of the Persistence Slot in question. * **Returns:** * //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. * **Parameters:** * //slot_name//\\ The name of the Persistence Slot in question. * **Returns:** * //Success//\\ The space, in bytes, used by the JSON encoded objects in the Persistence Slot. * //Failure//\\ An empty (NULL) result.