-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathQueueInterface.php
More file actions
91 lines (77 loc) · 1.68 KB
/
Copy pathQueueInterface.php
File metadata and controls
91 lines (77 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
/**
* Created by PhpStorm.
* User: inhere
* Date: 2017/5/21
* Time: 上午1:26
*/
namespace Inhere\Queue;
/**
* Interface QueueInterface
* @package Inhere\Queue
*
* @property string $driver
*/
interface QueueInterface
{
/**
* Priorities
*/
const PRIORITY_HIGH = 0;
const PRIORITY_NORM = 1;
const PRIORITY_LOW = 2;
const PRIORITY_LOW_SUFFIX = '_low';
const PRIORITY_HIGH_SUFFIX = '_high';
/**
* Events list
*/
const EVENT_BEFORE_PUSH = 'beforePush';
const EVENT_AFTER_PUSH = 'afterPush';
const EVENT_ERROR_PUSH = 'errorPush';
const EVENT_BEFORE_POP = 'beforePop';
const EVENT_AFTER_POP = 'afterPop';
const EVENT_ERROR_POP = 'errorPop';
/**
* push data
* @param mixed $data
* @param int $priority
* @return bool
*/
public function push($data, $priority = self::PRIORITY_NORM): bool;
/**
* pop data
* @param null|int $priority If is Null, pop all queue data by priority.
* @param bool $block Whether block pop
* @return mixed
*/
public function pop($priority = null, $block = false);
/**
* @param int $priority
* @return int
*/
public function count($priority = self::PRIORITY_NORM);
/**
* @return string|int
*/
public function getId();
/**
* @return array
*/
public function getChannels();
/**
* @return array
*/
public function getIntChannels();
/**
* @return string
*/
public function getDriver(): string;
/**
* @return int
*/
public function getErrCode(): int;
/**
* @return string
*/
public function getErrMsg(): string;
}