Database¶
A virtualized class for storing opencrowd components
-
class
opencrowd.model.database.Database(db_host, db_port)¶ The values below will generally default from opencrowd.config.redis
Parameters: - db_host (str) – database ip address
- db_port (int) – port number to access on the database
-
connect()¶ Currently connects to a redis host.
-
delete(key)¶ Delete the key and its associated value from the database
Parameters: key (str) – key and associated value to delete
-
exists(opencrowd_id)¶ Check if an opencrowd object exists
Parameters: opencrowd_id (str) – HEADER + id of the object to lookup Returns: True or False Return type: bool
-
get(key)¶ Unpickle the value from the database
Parameters: key (str) – Key to unpickle (HEADER + opencrowd_id)
-
set(key, value)¶ Pickles the value and sets the database based on k:v
Parameters: - key (str) – the access key to store the value under (HEADER + opencrowd_id)
- value (object) – value to store under the access key