mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 17:45:28 +00:00
change database access, use local cache getter implementation
This commit is contained in:
parent
caba131a00
commit
6b21d69104
3 changed files with 4 additions and 17 deletions
|
|
@ -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();
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue