Created
August 28, 2019 11:49
-
-
Save incrize/d7c4d45d5075d87e1caa8b24ea777e40 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*************************************************************************** | |
* * | |
* (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev * | |
* * | |
* This is commercial software, only users who have purchased a valid * | |
* license and accept to the terms of the License Agreement can install * | |
* and use this program. * | |
* * | |
**************************************************************************** | |
* PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE * | |
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. * | |
****************************************************************************/ | |
use \Tygh\Registry; | |
$php_value = phpversion(); | |
if (version_compare($php_value, '5.6.0') == -1) { | |
echo 'Currently installed PHP version (' . $php_value . ') is not supported. Minimal required PHP version is 5.6.0.'; | |
die(); | |
} | |
define('AREA', 'A'); | |
define('ACCOUNT_TYPE', 'admin'); | |
$scenario = isset($_REQUEST['scenario']) ? $_REQUEST['scenario'] : null; | |
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; | |
try { | |
require(dirname(__FILE__) . '/init.php'); | |
switch ($scenario) { | |
default: | |
case 'simple': | |
Registry::registerCache('test_1', ['test_table_1'], Registry::cacheLevel('static')); | |
if (!Registry::isExist('test_1')) { | |
Registry::set('test_1', rand(10, 1000000)); | |
} | |
if ($action === 'reset') { | |
Registry::setChangedTables('test_table_1'); | |
header('Location: ' . fn_query_remove($_SERVER['REQUEST_URI'], 'action')); | |
die('done'); | |
} | |
var_dump(Registry::get('test_1')); | |
break; | |
case 'cache_level_time': | |
Registry::registerCache('test_cache_level_time', 10, Registry::cacheLevel('time')); | |
if (!Registry::isExist('test_cache_level_time')) { | |
Registry::set('test_cache_level_time', rand(10, 1000000)); | |
} | |
var_dump(Registry::get('test_cache_level_time')); | |
break; | |
case 'ttl': | |
Registry::registerCache('test_ttl', ['update_handlers' => ['test_table_2'], 'ttl' => 30], Registry::cacheLevel('static')); | |
if (!Registry::isExist('test_ttl')) { | |
Registry::set('test_ttl', rand(10, 1000000)); | |
} | |
if ($action === 'reset') { | |
Registry::setChangedTables('test_table_2'); | |
header('Location: ' . fn_query_remove($_SERVER['REQUEST_URI'], 'action')); | |
die('done'); | |
} | |
var_dump(Registry::get('test_ttl')); | |
break; | |
} | |
die(); | |
fn_dispatch(); | |
} catch (Tygh\Exceptions\AException $e) { | |
$e->output(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment