-
-
Save iKlsR/c6dff55e93ec922020aa839c19fd0708 to your computer and use it in GitHub Desktop.
php-redis-on-windows
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 | |
$host = 'test.kvstore.aliyuncs.com'; | |
$port = 6379; | |
$user = 'username'; | |
$pwd = 'password1234'; | |
$key = 'the_stored_key'; | |
$redis = new Redis(); | |
if ($redis->connect($host, $port) == false) { | |
die($redis->getLastError()); | |
} | |
if ($redis->auth($pwd) == false) { | |
die($redis->getLastError()); | |
} | |
if ($redis->set($key, 'this is a test string. '.rand(100, 10000)) == false) { | |
die($redis->getLastError()); | |
} | |
$value = $redis->get($key); | |
echo '<hr/>get data from Redis: '.$key.' = '.$value; | |
?> |
Author
iKlsR
commented
Jun 16, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment