<?php

require_once '../../src/dalmp.php';
$di = new DALMP\DI();
$user = getenv('MYSQL_USER') ?: 'root';
$password = getenv('MYSQL_PASS') ?: '';
$host = getenv('MYSQL_HOST') ?: '127.0.0.1';
$port = getenv('MYSQL_PORT') ?: '3306';
$DSN = "utf8://{$user}:{$password}" . '@127.0.0.1/test';
$db = $di->database($DSN);
$redis_cache = $di->cache_redis('127.0.0.1', 6379);
$cache = $di->cache($redis_cache);
$sessions = $di->sessions($di->sessions_redis($redis_cache), 'sha512');
$sessions->regenerate_id(true);
$db->useCache($cache);
$now = $db->CachegetOne('SELECT NOW()');
echo $now, PHP_EOL;
echo session_id();
Beispiel #2
0
Datei: X.php Projekt: nbari/DALMP
<?php

require_once '../../MPLT.php';
$timer = new MPLT();
require_once '../../src/dalmp.php';
# ------------------------------------------------------------------------------
$di = new DALMP\DI();
$user = getenv('MYSQL_USER') ?: 'root';
$password = getenv('MYSQL_PASS') ?: '';
$host = getenv('MYSQL_HOST') ?: '127.0.0.1';
$port = getenv('MYSQL_PORT') ?: '3306';
$db = $di->database("utf8://{$user}:{$password}@{$host}:{$port}/dalmp");
$db->debug();
echo 'connect ', var_dump($db->connect());
sleep(3);
echo 'ping: ', var_dump($db->X()->ping());
echo 'thread_safe: ', var_dump($db->X()->thread_safe());
echo 'client_info: ', var_dump($db->X()->get_client_info());
echo 'client_version: ', var_dump($db->X()->client_version);
echo 'server_info: ', var_dump($db->X()->server_info);
echo 'server_version: ', var_dump($db->X()->server_version);
echo $timer->isCli(1), $db, $timer->isCli(1);
echo $timer->isCli(1), $db->GetOne('SELECT NOW()'), $timer->isCli(1);
$db->closeConnection();
echo 'is connected: ', var_dump($db->isConnected());
sleep(3);
echo 'ping: ', var_dump($db->X()->ping());
echo $timer->isCli(1), $db->GetOne('SELECT NOW()'), $timer->isCli(1);
sleep(3);
# ------------------------------------------------------------------------------
echo PHP_EOL, str_repeat('-', 80), PHP_EOL, 'Time: ', $timer->getPageLoadTime(), ' - Memory: ', $timer->getMemoryUsage(1), PHP_EOL, str_repeat('-', 80), PHP_EOL;
Beispiel #3
0
<?php

require_once '../../src/dalmp.php';
$di = new DALMP\DI();
$user = getenv('MYSQL_USER') ?: 'root';
$password = getenv('MYSQL_PASS') ?: '';
$host = getenv('MYSQL_HOST') ?: '127.0.0.1';
$port = getenv('MYSQL_PORT') ?: '3306';
$ok = $di->database("utf8://{$user}:{$password}@{$host}:{$port}/dalmp");
echo $ok;
$ok->debug();
$now = $ok->getOne('SELECT NOW()');
echo $now, PHP_EOL;
sleep(10);
$now = $ok->getOne('SELECT NOW()');
echo $now, PHP_EOL;
sleep(10);
$city = $ok->PgetAll('SELECT * FROM City WHERE name like ?', '%timor%');
print_r($city);
sleep(10);
$now = $ok->getOne('SELECT NOW()');
echo $now, PHP_EOL;
echo 'ping: ';
var_dump($ok->X()->ping());
sleep(5);
class teste
{
    public function __construct()
    {
        print_r(func_get_args());
    }