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