$ wget http://download.redis.io/releases/redis-3.0.3.tar.gz
$ tar xzf redis-3.0.3.tar.gz
$ cd redis-3.0.3
$ make

src/redis-server

-------------------------------------

$ src/redis-cli
redis> set foo bar
OK
redis> get foo
"bar"

--------------------------------------
go get gopkg.in/redis.v3

---------

package main

import (
"gopkg.in/redis.v3"
"fmt"
)

func main() {
client := redis.NewClient(&redis.Options{
Addr: "localhost:6379",
Password: "", // no password set
DB: 0, // use default DB
})

defer client.Close()

pong, err := client.Ping().Result()
fmt.Println(pong, err)
// Output: PONG <nil>

err = client.Set("key", "value", 0).Err()
if err != nil {
panic(err)
}

val, err := client.Get("key").Result()
if err != nil {
panic(err)
}
fmt.Println("key", val)

}

install redis and used in golang on ubuntu 14.04的更多相关文章

  1. How to install Pygame for Python 3.4 on Ubuntu 14.04(转)

    First run this to install dependencies: sudo apt-get install mercurial python3-dev python3-numpy \ l ...

  2. 安装Ubuntu 14.04后要做的5件事情

    转自安装Ubuntu 14.04后要做的5件事情 Ubuntu目前是世界上最流行的Linux操作系统,它提供了桌面版本和服务器版本,其他流行的Linux发行版本如Linux Mint也是基于Ubunt ...

  3. 【旧版本】Ubuntu 14.04 下 P416编译器 p4c的安装

    注:此为2017年5月份的安装方法,最新的p4c安装方法见: Ubuntu14.04下 安装p4c 参考: p4c README Ubuntu 14.04 下 P4v16编译器 p4c的安装 系统要求 ...

  4. Ubuntu 14.04 下安装Skype

    操作1: Ubuntu 14.04 下安装Skype,使用 Ctr+Alt+T组合键打开终端Terminal,输入如下即可: wget -O skype.deb http://download.sky ...

  5. How To Use PostgreSQL with Your Ruby on Rails Application on Ubuntu 14.04

    How To Use PostgreSQL with Your Ruby on Rails Application on Ubuntu 14.04 链接来自于:https://www.digitalo ...

  6. Ubuntu 14.04 Ruby 2.3.3 安装

    在Ubuntu 14.04通过下载Ruby源码包进行安装. 第一步,更新apt-get sudo apt-get update 通过apt-get安装ruby依赖 sudo apt-get insta ...

  7. Redis、Redis+sentinel安装(Ubuntu 14.04下Redis安装及简单测试)

    Ubuntu下Redis安装两种安装方式: 1.apt-get方式 步骤: 以root权限登录,切换到/usr目录下. 接下来输入命令,apt-get install redis-server,如图: ...

  8. How To Configure a Redis Cluster on Ubuntu 14.04

    原文:https://www.digitalocean.com/community/tutorials/how-to-configure-a-redis-cluster-on-ubuntu-14-04 ...

  9. Install Google Pinyin on Ubuntu 14.04

    Install Google Pinyin on Ubuntu 14.04 I've been spending more and more time on Ubuntu and I'm not us ...

随机推荐

  1. undefined is not a function

    具体报错 TypeError: c:\Users\Administrator\WebstormProjects\blogtest\views\index.ejs:1 >> 1| <% ...

  2. watir 的api在线文档

    http://rubydoc.info/gems/watir-webdriver/frames http://rdoc.info/gems/watir-webdriver/frames http:// ...

  3. StringMVC

    public class FirstController implements Controller { public ModelAndView handleRequest(HttpServletRe ...

  4. vue2.0:(五)、路由vue-router

    好的,接下来,我们来写路由.用的是vue2.0的路由. 步骤一:配置main.js import Vue from 'vue'; import App from './App'; import rou ...

  5. Kail安装后的配置

    安装完Kail系统后进行简单的几项配置可以让使用更方便 VMware安装Kail系统这里就不介绍了,大家可以参考这个博客:http://www.cnblogs.com/xuanhun/p/568831 ...

  6. 在CesiumVR基础上实现3D左右立体视觉

    整体思路 在VR模块的基础上调整视差,使其随距离发生变化: 左右分屏时,需要将左右屏的横向进行1/2压缩:这是因为3D-TV在对左右格式影像进行合并时,会进行拉伸: 左屏幕的相机相对于原来的(右屏)相 ...

  7. ueditor1_3_6 一点问题记录

    文件:getRemoteImage.php 第49行: if ( !in_array( $fileType , $config[ 'allowFiles' ] ) || stristr( $heads ...

  8. uva 1601 poj 3523 Morning after holloween 万圣节后的早晨 (经典搜索,双向bfs+预处理优化+状态压缩位运算)

    这题数据大容易TLE 优化:预处理, 可以先枚举出5^3的状态然后判断合不合法,但是由于题目说了有很多墙壁,实际上没有那么多要转移的状态那么可以把底图抽出来,然后3个ghost在上面跑到时候就不必判断 ...

  9. Python静态方法 类方法

    通常情况下,类中函数中定义的所有函数,,都是对象的绑定方法,除此之外,还有专门的静态方法和类方法,这两个是专门给类使用的,但是对象非要调用也是不会报错的. 对象在调用的时候会把自己传递给self,也就 ...

  10. apropos linux

    Apropos adj. 恰当的,关于,就...而言 adv. 顺便地,恰当地 All my suggestions apropos the script were accepted. 我所有有关该剧 ...