2023-04-03 11:08:11 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Kiri\Di\Context;
|
|
|
|
|
|
|
|
|
|
interface ContextInterface
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param string $key
|
|
|
|
|
* @param mixed $value
|
|
|
|
|
* @param int|null $coroutineId
|
|
|
|
|
* @return mixed
|
|
|
|
|
*/
|
|
|
|
|
public static function set(string $key, mixed $value, ?int $coroutineId = null): mixed;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param string $key
|
|
|
|
|
* @param mixed|null $defaultValue
|
|
|
|
|
* @param int|null $coroutineId
|
|
|
|
|
* @return mixed
|
|
|
|
|
*/
|
|
|
|
|
public static function get(string $key, mixed $defaultValue = null, ?int $coroutineId = null): mixed;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param string $key
|
|
|
|
|
* @param int|null $coroutineId
|
|
|
|
|
* @return mixed
|
|
|
|
|
*/
|
|
|
|
|
public static function exists(string $key, ?int $coroutineId = null): bool;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param string $key
|
|
|
|
|
* @param int|null $coroutineId
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public static function remove(string $key, ?int $coroutineId = null): void;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2023-04-03 11:10:15 +08:00
|
|
|
* @param string $id
|
2023-04-03 11:08:11 +08:00
|
|
|
* @param int $value
|
2023-04-03 14:18:58 +08:00
|
|
|
* @param int|null $coroutineId
|
2023-04-03 11:17:15 +08:00
|
|
|
* @return int
|
2023-04-03 11:08:11 +08:00
|
|
|
*/
|
2023-04-03 14:18:58 +08:00
|
|
|
public static function increment(string $id, int $value = 1, ?int $coroutineId = null): int;
|
2023-04-03 11:08:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2023-04-03 11:10:15 +08:00
|
|
|
* @param string $id
|
2023-04-03 11:08:11 +08:00
|
|
|
* @param int $value
|
2023-04-03 14:18:58 +08:00
|
|
|
* @param int|null $coroutineId
|
2023-04-03 11:17:15 +08:00
|
|
|
* @return int
|
2023-04-03 11:08:11 +08:00
|
|
|
*/
|
2023-04-03 14:18:58 +08:00
|
|
|
public static function decrement(string $id, int $value = 1, ?int $coroutineId = null): int;
|
2023-04-03 11:08:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|