Skip to content

Commit

Permalink
Update Readme, add pool example
Browse files Browse the repository at this point in the history
  • Loading branch information
luca3m committed May 2, 2014
1 parent 588a672 commit d990a09
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ See [examples](https://github.com/luca3m/redis3m/tree/master/examples) directory
g++ <example.cpp> $(pkg-config --cflags --libs redis3m) -o <example.bin>
```

As reference you can read [include](https://github.com/luca3m/redis3m/tree/master/include) files, they are pretty simple and some of them are already documented with Doxygen.
You can find all classes reference [here](http://luca3m.me/redis3m/docs)

### Versioning

Expand Down
17 changes: 17 additions & 0 deletions examples/pool.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <redis3m/redis3m.hpp>
#include <iostream>

using namespace redis3m;

int main(int argc, char **argv)
{
connection_pool::ptr_t pool = connection_pool::create("<yoursentinel>", "test");

connection::ptr_t c = pool->get(connection::MASTER);
c->run(command("SET")("foo")("bar"));
pool->put(c);

c = pool->get(connection::SLAVE);
std::cout << c->run(command("GET")("foo")).str();
pool->put(c);
}

0 comments on commit d990a09

Please sign in to comment.