PHP code example of maatify / redis

1. Go to this page and download the library: Download maatify/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/ */

    

maatify / redis example snippets




$redis = new RedisDefaultHandler('maatify:');
$key_name = 'test';
$redis->Set($key_name, 'test:' . date('Y-m-d H:i:s'));

echo $redis->Get($key_name);


echo '<br><hr><br>';

echo $redis->TTL($key_name);



$redis = new RedisHandler(
(string) $redis_host = '127.0.0.1', 
(int) $redis_port = 6379, 
(string) $redis_password = 'Your Redis Password', 
(int) $redis_database = 1,
(int) $redis_expiry = 5*60, 
(string) $redis_website_prefix = 'maatify:'
);
$key_name = 'test_maatify';
$redis->Set($key_name, 'test_maatify:' . date('Y-m-d H:i:s'));

echo $redis->Get($key_name);


echo '<br><hr><br>';

echo $redis->TTL($key_name);