Browse Source

update shared memory pool api

PHP-GTK3
yggverse 4 months ago
parent
commit
9661eb21c5
  1. 8
      src/Abstract/Model/Connection.php
  2. 2
      src/Interface/Model/Connection.php
  3. 4
      src/Interface/Model/Pool.php
  4. 13
      src/Model/Pool.php

8
src/Abstract/Model/Connection.php

@ -41,6 +41,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
'mime', 'mime',
32 32
); );
$this->_pool->init( $this->_pool->init(
'data', 'data',
// 1 Mb default // 1 Mb default
@ -227,8 +228,13 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
return null; return null;
} }
public function reset(): void
{
$this->_pool->reset();
}
public function close(): void public function close(): void
{ {
$this->_pool->clean(); $this->_pool->close();
} }
} }

2
src/Interface/Model/Connection.php

@ -74,5 +74,7 @@ interface Connection
public function getLength(): ?int; public function getLength(): ?int;
public function reset(): void;
public function close(): void; public function close(): void;
} }

4
src/Interface/Model/Pool.php

@ -46,5 +46,7 @@ interface Pool
?string $value = null ?string $value = null
): void; ): void;
public function clean(): void; public function reset(): void;
public function close(): void;
} }

13
src/Model/Pool.php

@ -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) foreach ($this->_data as $key => $shmop)
{ {

Loading…
Cancel
Save