2022-02-24 15:24:29 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Kiri\Pool;
|
|
|
|
|
|
|
|
|
|
interface QueueInterface
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
2023-04-03 13:45:59 +08:00
|
|
|
/**
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
2022-02-24 15:24:29 +08:00
|
|
|
public function isEmpty(): bool;
|
|
|
|
|
|
|
|
|
|
|
2023-04-03 13:45:59 +08:00
|
|
|
/**
|
|
|
|
|
* @param mixed $data
|
|
|
|
|
* @param float $timeout
|
2023-04-03 13:55:24 +08:00
|
|
|
* @return bool
|
2023-04-03 13:45:59 +08:00
|
|
|
*/
|
2023-04-03 13:54:09 +08:00
|
|
|
public function push(mixed $data, float $timeout = -1): bool;
|
2022-02-24 15:24:29 +08:00
|
|
|
|
2023-04-03 13:45:59 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param float $timeout
|
|
|
|
|
* @return mixed
|
|
|
|
|
*/
|
2022-02-24 15:24:29 +08:00
|
|
|
public function pop(float $timeout = -1): mixed;
|
|
|
|
|
|
|
|
|
|
|
2023-04-03 13:45:59 +08:00
|
|
|
/**
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
2022-02-24 15:24:29 +08:00
|
|
|
public function stats(): array;
|
|
|
|
|
|
|
|
|
|
|
2023-04-03 13:45:59 +08:00
|
|
|
/**
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
2022-02-24 15:24:29 +08:00
|
|
|
public function close(): bool;
|
|
|
|
|
|
|
|
|
|
|
2023-04-03 13:45:59 +08:00
|
|
|
/**
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
2022-02-24 15:24:29 +08:00
|
|
|
public function length(): int;
|
|
|
|
|
|
|
|
|
|
|
2023-04-03 13:45:59 +08:00
|
|
|
/**
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
2022-02-24 15:24:29 +08:00
|
|
|
public function isFull(): bool;
|
|
|
|
|
|
2022-06-17 11:59:19 +08:00
|
|
|
|
2023-04-03 13:45:59 +08:00
|
|
|
/**
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
2022-06-17 11:59:19 +08:00
|
|
|
public function isClose(): bool;
|
|
|
|
|
|
2022-02-24 15:24:29 +08:00
|
|
|
}
|