Browse Source

init memory in controller

main
ghost 9 months ago
parent
commit
6cf46be788
  1. 11
      src/controller/room.php
  2. 13
      src/server.php

11
src/controller/room.php

@ -5,16 +5,21 @@ namespace Kevachat\Geminiapp\Controller; @@ -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();

13
src/server.php

@ -49,14 +49,6 @@ $config = json_decode( @@ -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( @@ -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( @@ -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( @@ -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( @@ -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( @@ -234,7 +222,6 @@ $server->setHandler(
include_once __DIR__ . '/controller/room.php';
$room = new \Kevachat\Geminiapp\Controller\Room(
$memory,
$config
);

Loading…
Cancel
Save