docs
uredis
Quick Start
Access Instance

Access Instance

For security reasons, cloud memory Redis instances can only be accessed from the internal network. Below is a brief description of how to access cloud memory storage using the Redis protocol as an example.

Access via telnet

[test@u205 ~]$ telnet 127.0.0.1 6379
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
set key value
+OK
get key
$5
value
del key
:1

Access via php

<?php
    $redis = new Redis();
    $redis->connect('10.4.7.17', 6379);
    $key = "testkey";
    $tvalue = "testvalue";
    $redis->set($key, $tvalue);
    $nvalue = $redis->get($key);
    print_r($nvalue . "\n");
?>

Access via Python

#!/usr/bin/env python2
# coding=utf8
 
import sys, os
import redis
 
if __name__ == "__main__":
 
    ip = '10.4.7.17'
    port = 6379
 
    r = redis.StrictRedis(ip, port, 0)
 
    key = 'testkey'
    tvalue = "testvalue"
    r.set(key, tvalue)
    nvalue = r.get(key)
    print nvalue
  • Company
  • ContactUs
  • Blog
Copyright © 2024 SurferCloud All Rights Reserved