Completed
Push — master ( 88363a...62c34e )
by Roberto
01:04
created

Keys::delete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Webdcg\Redis\Traits;
4
5
trait Keys
6
{
7
    /**
8
     * Remove specified keys [Blocking].
9
     *
10
     * @param  mixed $keys
11
     *
12
     * @return int Number of keys deleted
13
     */
14
    public function del(...$keys): int
15
    {
16
        return $this->redis->del(...$keys);
0 ignored issues
show
Bug introduced by
The property redis does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
17
    }
18
19
    /**
20
     * Remove specified keys [Non Blocking].
21
     *
22
     * @param  mixed $keys
23
     *
24
     * @return int Number of keys deleted
25
     */
26
    public function delete(...$keys): int
27
    {
28
        return $this->redis->unlink(...$keys);
29
    }
30
31
    /**
32
     * Remove specified keys [NonBlocking].
33
     *
34
     * Note: If you are connecting to Redis server >= 4.0.0 you can remove a
35
     * key with the unlink method in the exact same way you would use del.
36
     * The Redis unlink command is non-blocking and will perform the actual
37
     *  deletion asynchronously.
38
     *
39
     * @param  mixed $keys
40
     *
41
     * @return int Number of keys deleted
42
     */
43
    public function unlink(...$keys): int
44
    {
45
        return $this->redis->unlink(...$keys);
46
    }
47
48
    /**
49
     * Return a serialized version of the value stored at the specified key.
50
     *
51
     * @param  string $key
52
     *
53
     * @return mixed|string|false       The Redis encoded value of the key,
54
     *                                  or FALSE if the key doesn't exist
55
     */
56
    public function dump(string $key)
57
    {
58
        return $this->redis->dump($key);
59
    }
60
61
    /**
62
     * Verify if the specified key exists.
63
     *
64
     * @param  mixed] $keys
0 ignored issues
show
Documentation introduced by
The doc-type mixed] could not be parsed: Expected "|" or "end of type", but got "]" at position 5. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
65
     *
66
     * @return int
67
     */
68
    public function exists(...$keys): int
69
    {
70
        return $this->redis->exists(...$keys);
71
    }
72
}
73