mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
update shared memory pool api
This commit is contained in:
parent
287f843283
commit
9661eb21c5
4 changed files with 24 additions and 3 deletions
|
|
@ -41,6 +41,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
|
|||
'mime',
|
||||
32
|
||||
);
|
||||
|
||||
$this->_pool->init(
|
||||
'data',
|
||||
// 1 Mb default
|
||||
|
|
@ -227,8 +228,13 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
|
|||
return null;
|
||||
}
|
||||
|
||||
public function reset(): void
|
||||
{
|
||||
$this->_pool->reset();
|
||||
}
|
||||
|
||||
public function close(): void
|
||||
{
|
||||
$this->_pool->clean();
|
||||
$this->_pool->close();
|
||||
}
|
||||
}
|
||||
|
|
@ -74,5 +74,7 @@ interface Connection
|
|||
|
||||
public function getLength(): ?int;
|
||||
|
||||
public function reset(): void;
|
||||
|
||||
public function close(): void;
|
||||
}
|
||||
|
|
@ -46,5 +46,7 @@ interface Pool
|
|||
?string $value = null
|
||||
): void;
|
||||
|
||||
public function clean(): void;
|
||||
public function reset(): void;
|
||||
|
||||
public function close(): void;
|
||||
}
|
||||
|
|
@ -127,7 +127,18 @@ class Pool implements \Yggverse\Yoda\Interface\Model\Pool
|
|||
);
|
||||
}
|
||||
|
||||
public function clean(): void
|
||||
public function reset(): void
|
||||
{
|
||||
foreach ($this->_data as $key => $shmop)
|
||||
{
|
||||
$this->set(
|
||||
$key,
|
||||
null
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function close(): void
|
||||
{
|
||||
foreach ($this->_data as $key => $shmop)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue