Net-Async-Redis

 view release on metacpan or  search on metacpan

examples/mutex.pl  view on Meta::CPAN

            client_side_cache_size => 100,
        )
    );

    await $redis->connected;
    my $removed = $loop->new_future;
    die 'no cc cache?' unless $redis->is_client_side_cache_enabled;
    my $src = $redis->clientside_cache_events
        ->each(sub {
            $log->infof('Key change detected for %s', $_);
            if($_ eq 'task.busy') {
                my $f = $removed;
                $removed = $loop->new_future;
                $f->done
            } else {
                $log->infof('Nothing to do with us');
            }
        });

    my $timeout = $loop->delay_future(after => 5);
    until($timeout->is_ready) {
        await $loop->delay_future(after => 0.005 * rand);
        $log->infof('Try to set key');
        if(my $res = await $redis->set('task.busy' => $id, qw(NX GET PX), 3_000)) {
            $log->infof('We lost - res = %s', $res);
            if(await $redis->get('task.busy')) {
                await $removed;
                $log->infof('Notified removal');
            } else {
                $log->infof('Key disappeared');
            }
        } else {
            $log->infof('We won');
            ++$count{$id};
            await $loop->delay_future(after => 0.003 * rand);
            $log->infof('Release');
            await $redis->del('task.busy');
        }
    }
    return;
}, foreach => [1..10], concurrent => 10);
$log->infof('done');
$log->infof('Stats: %s', \%count);

share/commands.yaml  view on Meta::CPAN

  step: 0
  subcommands: []
  tips: {}
auth:
  acl_cat:
    '@connection': 1
    '@fast': 1
  arity: -2
  first_key: 0
  flags:
    allow_busy: 1
    fast: 1
    loading: 1
    no_auth: 1
    noscript: 1
    stale: 1
  key_spec: []
  last_key: 0
  name: auth
  step: 0
  subcommands: []

share/commands.yaml  view on Meta::CPAN

  tips:
    request_policy:multi_shard: 1
    response_policy:agg_sum: 1
discard:
  acl_cat:
    '@fast': 1
    '@transaction': 1
  arity: 1
  first_key: 0
  flags:
    allow_busy: 1
    fast: 1
    loading: 1
    noscript: 1
    stale: 1
  key_spec: []
  last_key: 0
  name: discard
  step: 0
  subcommands: []
  tips: {}

share/commands.yaml  view on Meta::CPAN

    - - '@write'
      - '@slow'
      - '@scripting'
    - - request_policy:all_shards
      - response_policy:all_succeeded
    - []
    - []
  - - function|kill
    - 2
    - - noscript
      - allow_busy
    - 0
    - 0
    - 0
    - - '@slow'
      - '@scripting'
    - - request_policy:all_shards
      - response_policy:one_succeeded
    - []
    - []
  - - function|restore

share/commands.yaml  view on Meta::CPAN

    - 0
    - 0
    - - '@slow'
      - '@scripting'
    - - nondeterministic_output_order
    - []
    - []
  - - function|stats
    - 2
    - - noscript
      - allow_busy
    - 0
    - 0
    - 0
    - - '@slow'
      - '@scripting'
    - - nondeterministic_output
      - request_policy:all_shards
      - response_policy:special
    - []
    - []

share/commands.yaml  view on Meta::CPAN

  step: 0
  subcommands: []
  tips: {}
function_kill:
  acl_cat:
    '@scripting': 1
    '@slow': 1
  arity: 2
  first_key: 0
  flags:
    allow_busy: 1
    noscript: 1
  key_spec: []
  last_key: 0
  name: function|kill
  step: 0
  subcommands: []
  tips:
    request_policy:all_shards: 1
    response_policy:one_succeeded: 1
function_list:

share/commands.yaml  view on Meta::CPAN

  tips:
    request_policy:all_shards: 1
    response_policy:all_succeeded: 1
function_stats:
  acl_cat:
    '@scripting': 1
    '@slow': 1
  arity: 2
  first_key: 0
  flags:
    allow_busy: 1
    noscript: 1
  key_spec: []
  last_key: 0
  name: function|stats
  step: 0
  subcommands: []
  tips:
    nondeterministic_output: 1
    request_policy:all_shards: 1
    response_policy:special: 1

share/commands.yaml  view on Meta::CPAN

  step: 1
  subcommands: []
  tips: {}
hello:
  acl_cat:
    '@connection': 1
    '@fast': 1
  arity: -1
  first_key: 0
  flags:
    allow_busy: 1
    fast: 1
    loading: 1
    no_auth: 1
    noscript: 1
    stale: 1
  key_spec: []
  last_key: 0
  name: hello
  step: 0
  subcommands: []

share/commands.yaml  view on Meta::CPAN

  step: 2
  subcommands: []
  tips: {}
multi:
  acl_cat:
    '@fast': 1
    '@transaction': 1
  arity: 1
  first_key: 0
  flags:
    allow_busy: 1
    fast: 1
    loading: 1
    noscript: 1
    stale: 1
  key_spec: []
  last_key: 0
  name: multi
  step: 0
  subcommands: []
  tips: {}

share/commands.yaml  view on Meta::CPAN

  step: 0
  subcommands: []
  tips: {}
quit:
  acl_cat:
    '@connection': 1
    '@fast': 1
  arity: -1
  first_key: 0
  flags:
    allow_busy: 1
    fast: 1
    loading: 1
    no_auth: 1
    noscript: 1
    stale: 1
  key_spec: []
  last_key: 0
  name: quit
  step: 0
  subcommands: []

share/commands.yaml  view on Meta::CPAN

  tips: {}
replconf:
  acl_cat:
    '@admin': 1
    '@dangerous': 1
    '@slow': 1
  arity: -1
  first_key: 0
  flags:
    admin: 1
    allow_busy: 1
    loading: 1
    noscript: 1
    stale: 1
  key_spec: []
  last_key: 0
  name: replconf
  step: 0
  subcommands: []
  tips: {}
replicaof:

share/commands.yaml  view on Meta::CPAN

  step: 0
  subcommands: []
  tips: {}
reset:
  acl_cat:
    '@connection': 1
    '@fast': 1
  arity: 1
  first_key: 0
  flags:
    allow_busy: 1
    fast: 1
    loading: 1
    no_auth: 1
    noscript: 1
    stale: 1
  key_spec: []
  last_key: 0
  name: reset
  step: 0
  subcommands: []

share/commands.yaml  view on Meta::CPAN

    - 0
    - - '@slow'
      - '@scripting'
    - - request_policy:all_nodes
      - response_policy:all_succeeded
    - []
    - []
  - - script|kill
    - 2
    - - noscript
      - allow_busy
    - 0
    - 0
    - 0
    - - '@slow'
      - '@scripting'
    - - request_policy:all_shards
      - response_policy:one_succeeded
    - []
    - []
  - - script|debug

share/commands.yaml  view on Meta::CPAN

  step: 0
  subcommands: []
  tips: {}
script_kill:
  acl_cat:
    '@scripting': 1
    '@slow': 1
  arity: 2
  first_key: 0
  flags:
    allow_busy: 1
    noscript: 1
  key_spec: []
  last_key: 0
  name: script|kill
  step: 0
  subcommands: []
  tips:
    request_policy:all_shards: 1
    response_policy:one_succeeded: 1
script_load:

share/commands.yaml  view on Meta::CPAN

  tips: {}
shutdown:
  acl_cat:
    '@admin': 1
    '@dangerous': 1
    '@slow': 1
  arity: -1
  first_key: 0
  flags:
    admin: 1
    allow_busy: 1
    loading: 1
    no_multi: 1
    noscript: 1
    stale: 1
  key_spec: []
  last_key: 0
  name: shutdown
  step: 0
  subcommands: []
  tips: {}

share/commands.yaml  view on Meta::CPAN

  step: 0
  subcommands: []
  tips: {}
unwatch:
  acl_cat:
    '@fast': 1
    '@transaction': 1
  arity: 1
  first_key: 0
  flags:
    allow_busy: 1
    fast: 1
    loading: 1
    noscript: 1
    stale: 1
  key_spec: []
  last_key: 0
  name: unwatch
  step: 0
  subcommands: []
  tips: {}

share/commands.yaml  view on Meta::CPAN

  tips:
    request_policy:all_shards: 1
    response_policy:agg_min: 1
watch:
  acl_cat:
    '@fast': 1
    '@transaction': 1
  arity: -2
  first_key: 1
  flags:
    allow_busy: 1
    fast: 1
    loading: 1
    noscript: 1
    stale: 1
  key_spec:
  - begin_search:
      spec:
        index: 1
      type: index
    find_keys:



( run in 0.347 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )