#!/www/server/bin/php <?php # test array_based process cache it_cache::put('it_cache_t', 42); is(it_cache::get('it_cache_t'), 42, "cache put number"); it_cache::put('it_cache_t', false); is(it_cache::get('it_cache_t'), false, "cache get number"); it_cache::put('it_cache_t', array(2)); is(it_cache::get('it_cache_t'), array(2), "cache put/get array"); # test non-distributed apc cache it_cache::put('it_cache_t', 42); unset($GLOBALS['it_cache_local']); is(it_cache::get('it_cache_t'), 42, "local put/get number"); it_cache::put('it_cache_t', false); unset($GLOBALS['it_cache_local']); is(it_cache::get('it_cache_t'), false, "local put/get false"); it_cache::put('it_cache_t', array(2)); unset($GLOBALS['it_cache_local']); is(it_cache::get('it_cache_t'), array(2), "local put/get array"); is(it_cache::get('it_cache_t'.rand(1, 1000)), null, "local get unknown key"); # test distributed memcache $GLOBALS['debug_aslive'] = 1; it_cache::put('it_cache_d', 42, array('distributed' => 1)); it_cache::put('it_cache_d', 0); unset($GLOBALS['it_cache_local']); is(intval(it_cache::get('it_cache_d', array('distributed' => 1))), 42, "distributed put/get number"); it_cache::put('it_cache_d', false, array('distributed' => 1)); it_cache::put('it_cache_d', 1); unset($GLOBALS['it_cache_local']); is(boolval(it_cache::get('it_cache_d', array('distributed' => 1))), false, "distributed put/get false"); it_cache::put('it_cache_d', array(2), array('distributed' => 1)); it_cache::put('it_cache_d', 0); unset($GLOBALS['it_cache_local']); is(it_cache::get('it_cache_d', array('distributed' => 1)), array(2), "distributed put/get array"); is(it_cache::get('it_cache_d'.rand(1, 1000), array('distributed' => 1)), null, "distributed get unknown key");