install redis and used in golang on ubuntu 14.04
$ 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的更多相关文章
- 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 ...
- 安装Ubuntu 14.04后要做的5件事情
转自安装Ubuntu 14.04后要做的5件事情 Ubuntu目前是世界上最流行的Linux操作系统,它提供了桌面版本和服务器版本,其他流行的Linux发行版本如Linux Mint也是基于Ubunt ...
- 【旧版本】Ubuntu 14.04 下 P416编译器 p4c的安装
注:此为2017年5月份的安装方法,最新的p4c安装方法见: Ubuntu14.04下 安装p4c 参考: p4c README Ubuntu 14.04 下 P4v16编译器 p4c的安装 系统要求 ...
- Ubuntu 14.04 下安装Skype
操作1: Ubuntu 14.04 下安装Skype,使用 Ctr+Alt+T组合键打开终端Terminal,输入如下即可: wget -O skype.deb http://download.sky ...
- 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 ...
- Ubuntu 14.04 Ruby 2.3.3 安装
在Ubuntu 14.04通过下载Ruby源码包进行安装. 第一步,更新apt-get sudo apt-get update 通过apt-get安装ruby依赖 sudo apt-get insta ...
- Redis、Redis+sentinel安装(Ubuntu 14.04下Redis安装及简单测试)
Ubuntu下Redis安装两种安装方式: 1.apt-get方式 步骤: 以root权限登录,切换到/usr目录下. 接下来输入命令,apt-get install redis-server,如图: ...
- 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 ...
- 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 ...
随机推荐
- 快速开启MySQL慢日志查询的方法
MySQL慢日志查询对于很多刚接触MySQL数据的新人来说比较陌生,下面就为您介绍MySQL慢日志查询的用法和好处,供您参考. mysql有一个功能就是可以log下来运行的比较慢的sql语句,默认是 ...
- 译:Java 中的正则表达式性能概述
原文链接:https://www.baeldung.com/java-regex-performance 作者: baeldung 译者:Darren Luo 1. 概述 在本快速教程中,我们将展示模 ...
- 策略模式和php实现
策略模式: 策略模式(Strategy Pattern):定义一系列算法,将每一个算法封装起来,并让它们可以相互替换.策略模式让算法独立于使用它的客户而变化,也称为政策模式(Policy). 策略模式 ...
- eclipse中安装lombok插件
一:下载lombok 下载地址:https://projectlombok.org/downloads/lombok.jar 或者访问官网下载 https://projectlombok.org/ ...
- 关于验证码在IE中不刷新的快速解决方法
今天在做验证码的时候发现在IE中,验证码不会刷新,而谷歌等其他浏览器没有问题,所以我想到应该是缓存问题,因为IE默认的设置是如果访问地址没变化就不会去获取而是加载缓存中的内容 所以解决方案就是在验证码 ...
- mysql操作封装
<?php//连接数据库function connect(){ $link = mysql_connect(DB_HOST,DB_USER,DB_PWD)or die("数据库连接失 ...
- 织梦list/arclist标签调用文章内容
list标签: 1. 进入后台->模型表单-> 频道模型 -> 内容模型管理 -> 修改对应的模型 2. 列表附加字段-填写body 3. 调用时添加“addfields='b ...
- (四)SpringMVC之使用cookie实现记住密码的功能
注意:因为实现记住密码的功能需要用到json,所以需要加上这条语句: <script type="text/javascript" src="scripts/jqu ...
- java面试题(杨晓峰)---第八讲谈谈Vector,ArrayList,LinkedList有何区别?
Vector,ArrayList,LinkedList均为线性的数据结构,但是从现实方式与应用场景中又存在差别. 1 底层实现方式 ArrayList内部数组来实现,LinkedList内部采用双向链 ...
- C#的位运算
链接地址: http://www.cnblogs.com/NetBelieve/archive/2012/07/30/2615006.html