redis3m  1.0.0
 All Classes Functions Variables Enumerations Pages
Public Member Functions | List of all members
redis3m::patterns::simple_obj_store< Model > Class Template Reference

Simple object storage, ready to use save, find and remove of model classes. id management is not provided. More...

#include <simple_obj_store.h>

Public Member Functions

Model find (connection::ptr_t connection, const std::string &id)
 As the name says, get an object from id specifying it's unique identifier. More...
 
void append_save (connection::ptr_t connection, const Model &m)
 Save an object on database, or update it if it's already present. Append only method, for using inside a transaction for example. You should take care of calling connection::get_reply() after it. More...
 
void save (connection::ptr_t connection, const Model &m)
 Save an object on database, or update it if it's already present. More...
 
void append_remove (connection::ptr_t connection, const Model &m)
 Remove object and all related data from database. Append only method, for using inside a transaction for example. You should take care of calling connection::get_reply() after it. More...
 
void remove (connection::ptr_t connection, const Model &m)
 Remove object and all related data from database. More...
 
std::string model_key (const std::string &id)
 Returns Redis Key used to save object data. More...
 

Detailed Description

template<typename Model>
class redis3m::patterns::simple_obj_store< Model >

Simple object storage, ready to use save, find and remove of model classes. id management is not provided.

Member Function Documentation

template<typename Model >
void redis3m::patterns::simple_obj_store< Model >::append_remove ( connection::ptr_t  connection,
const Model &  m 
)
inline

Remove object and all related data from database. Append only method, for using inside a transaction for example. You should take care of calling connection::get_reply() after it.

Parameters
conn
model
template<typename Model >
void redis3m::patterns::simple_obj_store< Model >::append_save ( connection::ptr_t  connection,
const Model &  m 
)
inline

Save an object on database, or update it if it's already present. Append only method, for using inside a transaction for example. You should take care of calling connection::get_reply() after it.

Parameters
conn
model
template<typename Model >
Model redis3m::patterns::simple_obj_store< Model >::find ( connection::ptr_t  connection,
const std::string &  id 
)
inline

As the name says, get an object from id specifying it's unique identifier.

Parameters
conn
id
Returns
Use model.loaded() to check if it's valid or not
template<typename Model >
std::string redis3m::patterns::simple_obj_store< Model >::model_key ( const std::string &  id)
inline

Returns Redis Key used to save object data.

Parameters
id
Returns
template<typename Model >
void redis3m::patterns::simple_obj_store< Model >::remove ( connection::ptr_t  connection,
const Model &  m 
)
inline

Remove object and all related data from database.

Parameters
conn
model
template<typename Model >
void redis3m::patterns::simple_obj_store< Model >::save ( connection::ptr_t  connection,
const Model &  m 
)
inline

Save an object on database, or update it if it's already present.

Parameters
conn
model

The documentation for this class was generated from the following file: