| blib/lib/Mojo/Redis/Cache.pm | |||
|---|---|---|---|
| Criterion | Covered | Total | % |
| branch | 18 | 30 | 60.0 |
| line | true | false | branch |
|---|---|---|---|
| 27 | 2 | 3 | $self->refresh ? : |
| 29 | 1 | 4 | $_[0] ? : |
| 30 | 0 | 5 | if $expire < 0 |
| 31 | 4 | 1 | unless $data |
| 38 | 4 | 0 | ref $_[0] eq 'ARRAY' ? : |
| 51 | 0 | 3 | $expire < 0 ? : |
| 58 | 0 | 3 | &blessed($data) && $data->can('then') ? : |
| 65 | 0 | 0 | unless $data |
| 68 | 0 | 0 | if $data->[1] and _time() < $data->[1] |
| 77 | 0 | 0 | unless (eval { do { $self->_compute_p($key, $expire, $compute)->then(sub { $p->resolve(shift(), {"computed", 1, "expired", 1}); } , sub { $p->resolve($data->[0], {"error", $_[0], "expired", 1}); } ) } }) |
| 85 | 0 | 1 | unless state $c = eval "package Mojo::Redis::Connection::Offline;\nuse Mojo::Base 'Mojo::Redis::Connection';\nour \$STORE = {}; # Meant for internal use only\n\nsub write_p {\n my (\$conn, \$op, \$key) = (shift, shift, shift);\n\n if (\$op eq 'SET') {\n \$STORE->{\$conn->url}{\$key} = [\$_[0], defined \$_[2] ? \$_[2] + Mojo::Redis::Cache::_time() * 1000 : undef];\n return Mojo::Promise->new->resolve('OK');\n }\n else {\n my \$val = \$STORE->{\$conn->url}{\$key} || [];\n my \$expired = \$val->[1] && \$val->[1] < Mojo::Redis::Cache::_time() * 1000;\n delete \$STORE->{\$conn->url}{\$key} if \$expired;\n return Mojo::Promise->new->resolve(\$expired ? undef : \$val->[0]);\n }\n}\n\n'Mojo::Redis::Connection::Offline';\n" |
| 3 | 0 | defined $_[2] ? : | |
| 1 | 2 | if $expired | |
| 1 | 2 | $expired ? : | |
| 3 | 3 | if ($op eq 'SET') { } |