resque /
php-resque
| 1 | <?php |
||||
| 2 | |||||
| 3 | /** |
||||
| 4 | * Resque statistic management (jobs processed, failed, etc) |
||||
| 5 | * |
||||
| 6 | * @package Resque/Stat |
||||
| 7 | * @author Chris Boulton <[email protected]> |
||||
| 8 | * @license http://www.opensource.org/licenses/mit-license.php |
||||
| 9 | */ |
||||
| 10 | class Resque_Stat |
||||
| 11 | { |
||||
| 12 | /** |
||||
| 13 | * Get the value of the supplied statistic counter for the specified statistic. |
||||
| 14 | * |
||||
| 15 | * @param string $stat The name of the statistic to get the stats for. |
||||
| 16 | * @return mixed Value of the statistic. |
||||
| 17 | 8 | */ |
|||
| 18 | public static function get($stat) |
||||
| 19 | 8 | { |
|||
| 20 | return (int)Resque::redis()->get('stat:' . $stat); |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 21 | } |
||||
| 22 | |||||
| 23 | /** |
||||
| 24 | * Increment the value of the specified statistic by a certain amount (default is 1) |
||||
| 25 | * |
||||
| 26 | * @param string $stat The name of the statistic to increment. |
||||
| 27 | * @param int $by The amount to increment the statistic by. |
||||
| 28 | * @return boolean True if successful, false if not. |
||||
| 29 | 17 | */ |
|||
| 30 | public static function incr($stat, $by = 1) |
||||
| 31 | 17 | { |
|||
| 32 | return (bool)Resque::redis()->incrby('stat:' . $stat, $by); |
||||
|
0 ignored issues
–
show
The method
incrby() does not exist on Resque_Redis. Since you implemented __call, consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 33 | } |
||||
| 34 | |||||
| 35 | /** |
||||
| 36 | * Decrement the value of the specified statistic by a certain amount (default is 1) |
||||
| 37 | * |
||||
| 38 | * @param string $stat The name of the statistic to decrement. |
||||
| 39 | * @param int $by The amount to decrement the statistic by. |
||||
| 40 | * @return boolean True if successful, false if not. |
||||
| 41 | 2 | */ |
|||
| 42 | public static function decr($stat, $by = 1) |
||||
| 43 | 2 | { |
|||
| 44 | return (bool)Resque::redis()->decrby('stat:' . $stat, $by); |
||||
|
0 ignored issues
–
show
The method
decrby() does not exist on Resque_Redis. Since you implemented __call, consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 45 | } |
||||
| 46 | |||||
| 47 | /** |
||||
| 48 | * Delete a statistic with the given name. |
||||
| 49 | * |
||||
| 50 | * @param string $stat The name of the statistic to delete. |
||||
| 51 | * @return boolean True if successful, false if not. |
||||
| 52 | 17 | */ |
|||
| 53 | public static function clear($stat) |
||||
| 54 | 17 | { |
|||
| 55 | return (bool)Resque::redis()->del('stat:' . $stat); |
||||
|
0 ignored issues
–
show
The method
del() does not exist on Resque_Redis. Since you implemented __call, consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 56 | } |
||||
| 57 | } |
||||
| 58 |