Object-Redis-Mapper is a convenient pattern to store object on Redis. Useful when you need classic CRUD operations. It's compatible and inspired by http://github.com/soveran/ohm. Data can be indexed and it supports also uniques. To use it make a subclass of model to model your attribute and use it to fill orm template parameter.
More...
|
Model | find_by_id (connection::ptr_t conn, const std::string &id) |
| As the name says, get an object from id specifying it's unique identifier. More...
|
|
Model | find_by_unique_field (connection::ptr_t conn, const std::string &field, const std::string &value) |
| Find an object by using a unique field. More...
|
|
bool | exists_by_id (connection::ptr_t conn, const std::string &id) |
| Check if an object exists or not. More...
|
|
std::string | save (connection::ptr_t conn, const Model &model) |
| Save an object on database, or update it if it's already present. More...
|
|
void | remove (connection::ptr_t conn, const Model &model) |
| Remove object and all related data from database. More...
|
|
std::vector< std::string > | list_members (connection::ptr_t conn, const Model &m, const std::string &list_name) |
|
void | set_add (connection::ptr_t conn, const Model &m, const std::string &set_name, const std::string &entry) |
|
void | set_remove (connection::ptr_t conn, const Model &m, const std::string &set_name, const std::string &entry) |
|
std::set< std::string > | set_members (connection::ptr_t conn, const Model &m, const std::string &set_name) |
|
std::string | collection_key () |
| Redis key of a SET containing all object ids. Useful for custom operations. Pay attention to mantain compatibility with all other functions. More...
|
|
std::string | collection_id_key () |
| Key containing an incremental counter, used to generate an id for new objects. Useful for custom operations. Pay attention to mantain compatibility with all other functions. More...
|
|
std::string | model_key (const std::string &id) |
| Returns Redis Key used to save object data. More...
|
|
std::string | tracked_key (const std::string &id, const std::string &key) |
| Returns full key, related to object. More...
|
|
std::string | indexed_field_key (const std::string &field, const std::string &value) |
|
std::string | unique_field_key (const std::string &field) |
|
template<typename Model>
class redis3m::patterns::orm< Model >
Object-Redis-Mapper is a convenient pattern to store object on Redis. Useful when you need classic CRUD operations. It's compatible and inspired by http://github.com/soveran/ohm. Data can be indexed and it supports also uniques. To use it make a subclass of model to model your attribute and use it to fill orm template parameter.