change database access, use local cache getter implementation

This commit is contained in:
yggverse 2024-08-03 22:30:09 +03:00
parent caba131a00
commit 6b21d69104
3 changed files with 4 additions and 17 deletions

View file

@ -9,7 +9,7 @@ use \Yggverse\Yoda\Model\Pool;
abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
{ {
private Database $_database; public Database $database;
private Pool $_pool; private Pool $_pool;
@ -17,8 +17,8 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
Database $database, Database $database,
?Pool $pool = null ?Pool $pool = null
) { ) {
// Init database connection to store cached results // Init database connection
$this->_database = $database; $this->database = $database;
// Use shared memory pool for async operations // Use shared memory pool for async operations
$this->_pool = $pool ? $pool : new Pool; $this->_pool = $pool ? $pool : new Pool;
@ -261,15 +261,6 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
return null; return null;
} }
public function getCache(
string $request
): ?object
{
return $this->_database->cache->get(
$request
);
}
public function reset(): void public function reset(): void
{ {
$this->_pool->reset(); $this->_pool->reset();

View file

@ -82,10 +82,6 @@ interface Connection
public function getLength(): ?int; public function getLength(): ?int;
public function getCache(
string $request
): ?object;
public function reset(): void; public function reset(): void;
public function close(): void; public function close(): void;

View file

@ -75,7 +75,7 @@ class Nex
} }
// Try cache // Try cache
else if ($cache = $this->_connection->getCache($address->get())) else if ($cache = $this->_connection->database->cache->get($address->get()))
{ {
$this->_connection->setTitle( $this->_connection->setTitle(
$cache->title $cache->title