PHP code example of pardnchiu / redis
1. Go to this page and download the library: Download pardnchiu/redis library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pardnchiu / redis example snippets
// Initialize Redis client
$redis = new PD\Redis();
// Set value with expiration
$redis->set(0, "user:123", "user_data", 3600); // db 0, expires in 1 hour
// Get value
$data = $redis->get(0, "user:123"); // from db 0
// Check connection status
if ($redis->isConnected()) {
// Redis is connected and ready
}