redis_client.js 395 B

12345678910111213141516171819202122
  1. const redis = require('redis');
  2. const client = redis.createClient();
  3. console.log('OK');
  4. client.connect('127.0.0.1', 6379);
  5. client.on('connect', function(){
  6. console.log('Connected.');
  7. });
  8. async function demo(){
  9. await client.json.set('car','.',{node: 4433});
  10. const val = await client.json.get('car',{path: '.node',});
  11. console.log(`Value is: ${val}`);
  12. await client.quit();
  13. }
  14. demo();