… | |
… | |
21 | | BDB::READ_UNCOMMITTED, 0600; |
21 | | BDB::READ_UNCOMMITTED, 0600; |
22 | db_put $db, undef, "key", "data", 0, sub { |
22 | db_put $db, undef, "key", "data", 0, sub { |
23 | db_del $db, undef, "key"; |
23 | db_del $db, undef, "key"; |
24 | }; |
24 | }; |
25 | db_sync $db; |
25 | db_sync $db; |
|
|
26 | |
|
|
27 | # when you also use Coro, management is easy: |
|
|
28 | use Coro::BDB; |
26 | |
29 | |
27 | # automatic result processing with AnyEvent: |
30 | # automatic result processing with AnyEvent: |
28 | our $FH; open $FH, "<&=" . BDB::poll_fileno; |
31 | our $FH; open $FH, "<&=" . BDB::poll_fileno; |
29 | our $WATCHER = AnyEvent->io (fh => $FH, poll => 'r', cb => \&BDB::poll_cb); |
32 | our $WATCHER = AnyEvent->io (fh => $FH, poll => 'r', cb => \&BDB::poll_cb); |
30 | |
33 | |
… | |
… | |
329 | DESTROY (DBC_ornull *dbc) |
332 | DESTROY (DBC_ornull *dbc) |
330 | CODE: |
333 | CODE: |
331 | if (dbc) |
334 | if (dbc) |
332 | dbc->c_close (dbc); |
335 | dbc->c_close (dbc); |
333 | |
336 | |
|
|
337 | $int = $cursor->set_priority ($priority = PRIORITY_*) |
|
|
338 | |
334 | Example: |
339 | Example: |
335 | my $c = $db->cursor; |
340 | my $c = $db->cursor; |
336 | |
341 | |
337 | for (;;) { |
342 | for (;;) { |
338 | db_c_get $c, my $key, my $data, BDB::NEXT; |
343 | db_c_get $c, my $key, my $data, BDB::NEXT; |