Created
May 15, 2010 04:45
-
-
Save raphaelstolt/402018 to your computer and use it in GitHub Desktop.
Redis installation test script
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 | |
define('TEST_KEY', 'are_we_glued'); | |
$redis = new Redis(); | |
try { | |
$redis->connect('localhost', 6379); | |
$redis->set(TEST_KEY, 'yes'); | |
$glueStatus = $redis->get(TEST_KEY); | |
if ($glueStatus) { | |
$testKey = TEST_KEY; | |
echo "Glued with the Redis key value store:" . PHP_EOL; | |
echo "1. Got value '{$glueStatus}' for key '{$testKey}'." . PHP_EOL; | |
if ($redis->delete(TEST_KEY)) { | |
echo "2. And already removed the key/value pair again." . PHP_EOL; | |
} | |
} else { | |
echo "Not glued with the Redis key value store." . PHP_EOL; | |
} | |
} catch (RedisException $e) { | |
$exceptionMessage = $e->getMessage(); | |
echo "{$exceptionMessage}. Not glued with the Redis key value store." . PHP_EOL; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment