diff --git a/src/controller/room.php b/src/controller/room.php index 722d938..a11896b 100644 --- a/src/controller/room.php +++ b/src/controller/room.php @@ -5,16 +5,21 @@ namespace Kevachat\Geminiapp\Controller; class Room { private $_config; - private $_memory; private $_session; private \Kevachat\Kevacoin\Client $_kevacoin; + private \Yggverse\Cache\Memory $_memory; - public function __construct(\Yggverse\Cache\Memory $memory, $config) + public function __construct($config) { // Init memory - $this->_memory = $memory; + $this->_memory = new \Yggverse\Cache\Memory( + $config->memcached->server->host, + $config->memcached->server->port, + $config->memcached->server->namespace, + $config->memcached->server->timeout + ); // Init session $this->_session = rand(); diff --git a/src/server.php b/src/server.php index 51b9a2a..420f4f1 100644 --- a/src/server.php +++ b/src/server.php @@ -49,14 +49,6 @@ $config = json_decode( ) ); -// Init memory -$memory = new \Yggverse\Cache\Memory( - $config->memcached->server->host, - $config->memcached->server->port, - $config->memcached->server->namespace, - $config->memcached->server->timeout -); - // Init server $server = new \Yggverse\TitanII\Server(); @@ -71,7 +63,6 @@ $server->setKey( $server->setHandler( function (\Yggverse\TitanII\Request $request): \Yggverse\TitanII\Response { - global $memory; global $config; $response = new \Yggverse\TitanII\Response(); @@ -95,7 +86,6 @@ $server->setHandler( include_once __DIR__ . '/controller/room.php'; $room = new \Kevachat\Geminiapp\Controller\Room( - $memory, $config ); @@ -123,7 +113,6 @@ $server->setHandler( include_once __DIR__ . '/controller/room.php'; $room = new \Kevachat\Geminiapp\Controller\Room( - $memory, $config ); @@ -189,7 +178,6 @@ $server->setHandler( include_once __DIR__ . '/controller/room.php'; $room = new \Kevachat\Geminiapp\Controller\Room( - $memory, $config ); @@ -234,7 +222,6 @@ $server->setHandler( include_once __DIR__ . '/controller/room.php'; $room = new \Kevachat\Geminiapp\Controller\Room( - $memory, $config );