-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
34 lines (24 loc) · 725 Bytes
/
main.cpp
File metadata and controls
34 lines (24 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <nodepp/nodepp.h>
#include <redis/redis.h>
#include <nodepp/worker.h>
using namespace nodepp;
void onMain() {
auto db = redis::add("db://localhost:6379");
if( !db ){ throw except_t( "something went wrong" ); }
for( auto x=100; x-->0; ){ process::add([=](){
auto db = redis::add("db://localhost:6379");
if ( !db ){ throw except_t( "something went wrong" ); }
db.value().emit("LRANGE FOO 0 -1",[=]( string_t data ){
console::log( "->", x, data );
});
return -1;
}); }
db.value().emit( R"( MULTI
DEL FOO
LPUSH FOO 1
LPUSH FOO 2
LPUSH FOO 3
LPUSH FOO 4
LPUSH FOO 5
EXEC )" );
}