Let's start practicing using the redis key-value store from our node application. First require the redismodule, and then create a redis client that we can use to call commands on our redis server.

Use the client to set the name key to your name.

var redis = require('redis');
var client = redis.createClient();
client.set("name", "Zhentian");

We already have stored a value in the question key. Use the redis client to issue a get command to redis to retrieve and then log the value.

var redis = require('redis');
var client = redis.createClient();
client.get("question", function(err, data){
console.log(data);
});

[Node.js]31. Level 7: Redis coming for Node.js, Simple Redis Commands的更多相关文章

  1. 让JS代码Level提升的忍者秘籍(实用)

    本文章共2377字,预计阅读时间5-10分钟. 前言 没有前言. 你准备好成为同事眼中深藏不露.高深莫测.阳光帅气的前端开发了吗? 那就开始吧! 本文秉承宗旨:代码实用与逼格并存. 提升JS代码Lev ...

  2. node.js学习(三)简单的node程序&&模块简单使用&&commonJS规范&&深入理解模块原理

    一.一个简单的node程序 1.新建一个txt文件 2.修改后缀 修改之后会弹出这个,点击"是" 3.运行test.js 源文件 使用node.js运行之后的. 如果该路径下没有该 ...

  3. 深入浅出Node.js(一):什么是Node.js

    Node.js从2009年诞生至今,已经发展了两年有余,其成长的速度有目共睹.从在github的访问量超过Rails,到去年底Node.jsS创始人Ryan Dalh加盟Joyent获得企业资助,再到 ...

  4. KoaHub.js:使用ES6/7特性开发Node.js框架(2)

    介绍   KoaHub.js -- 基于 Koa.js 平台的 Node.js web 快速开发框架.可以直接在项目里使用 ES6/7(Generator Function, Class, Async ...

  5. KoaHub.js:使用ES6/7特性开发Node.js框架

    KoaHub.js -- 基于 Koa.js 平台的 Node.js web 快速开发框架.可以直接在项目里使用 ES6/7(Generator Function, Class, Async & ...

  6. 深入浅出Node.js(一):什么是Node.js(转贴)

    以下内容转自:http://www.infoq.com/cn/articles/what-is-nodejs/ 作者:崔康 [编者按]:Node.js从2009年诞生至今,已经发展了两年有余,其成长的 ...

  7. Node.js实战项目学习系列(1) 初识Node.js

    前言 一直想好好学习node.js都是半途而废的状态,这次沉下心来,想好好的学习下node.js.打算写一个系列的文章大概10几篇文章,会一直以实际案例作为贯穿的学习. 什么是node Node.js ...

  8. [转] node升级到8.0.0在vscode启动js执行文件报错

    由于升级node 到 8.0.0 版本 vscode 启动一直报错: `node --debug` and `node --debug-brk` are invalid. Please use `no ...

  9. 【Nodejs】【node.js 安装 和 配置Sublime Text的Node.js】

    [一] [安装nodejs] 第一步:下载安装文件: https://nodejs.org/en/download/ 第二步:安装nodejs 下载完成之后,双击"node-v6.10.1- ...

随机推荐

  1. BZOJ3589动态树

    **错误改了一上午. 先做熟练泼粪 k<=5,因此我们可以模拟这个过程,在线段树上把标记建出来然后pushup时候更新就好了. By:大奕哥 #include<bits/stdc++.h& ...

  2. HDU 6194 string string string(后缀自动机)

    [题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=3238 [题目大意] 给出一个字符串求其出现恰好k次的子串数量 [题解] 对串建立AC自 ...

  3. Makefile-fPIC,C++静态库与动态库

    在计算机领域中,地址无关代码 (英文: position-independent code,缩写为PIC),又称地址无关可执行文件 (英文: position-independent executab ...

  4. 读书笔记_Effective_C++_条款三十八:通过复合塑模出has-a或者is-implemented-in-terms-of

    如果说public是一种is-a的关系的话,那么复合就是has-a的关系.直观来说,复合就是在一个类中采用其他类的对象作为自身的成员变量,可以举个例子,像下面这样: class Person { pr ...

  5. 计算机音频基础-PCM简介

    我们在音频处理的时候经常会接触到PCM数据:它是模拟音频信号经模数转换(A/D变换)直接形成的二进制序列,该文件没有附加的文件头和文件结束标志. 声音本身是模拟信号,而计算机只能识别数字信号,要在计算 ...

  6. 在C#中实现视频播放器

    当我们需要在C#中实现视频播放器的时候,可以使用如下几种方法: 一.使用MediaPlayer ActiveX控件 在C#中支持视屏播放器最简单的方式就是插入MediaPlayer控件了,在WPF中还 ...

  7. DISQLite3 - A self-contained, embeddable, zero-configuration SQL database engine for Delphi

    DISQLite3 implements a self-contained, embeddable, zero-configuration SQL database engine for Delphi ...

  8. jquery实现回车键触发事件

    键盘事件有3: keydown,keypress,keyup,分别是按下,按着没上抬,上抬键盘 . 正确代码为: $(document).keyup(function(event){ if(event ...

  9. pytest文档23-使用多个fixture和fixture直接互相调用

    使用多个fixture 如果用例需要用到多个fixture的返回数据,fixture也可以return一个元组.list或字典,然后从里面取出对应数据. # test_fixture4.py impo ...

  10. Animatepacker for cocos2d-x 3.0 解析

    AnimatePacker 是大神老G为cocos2d-x2.0做的一个很简洁的工具 近期 e 的新项目用的是最新的cocos2d-x 3.0,因此改进了对应的解析代码 说明: 1.工具还是用的之前的 ...