Godown — Go 开发的分布式 Key-Value 数据库

148 阅读1分钟
原文链接: click.aliyun.com

Godown — Go 开发的分布式 Key-Value 数据库

技术小能手 2018-11-07 10:54:41 浏览50 评论0

摘要: Godown 是一个 Go 语言开发的简单、高效分布式 Key-Value 数据库,灵感来源 Redis,基于 Raft 协议,支持 String, Bitmap, Map, List。 演示视频 使用示例 通过 Go 客户端进行连接 package main import ( "fmt" "github.

Godown 是一个 Go 语言开发的简单、高效分布式 Key-Value 数据库,灵感来源 Redis,基于 Raft 协议,支持 String, Bitmap, Map, List。

演示视频

26112814_zht5.png

使用示例

通过 Go 客户端进行连接

package main

import (	"fmt"

	"github.com/namreg/godown/client")

func main() {
	c, err := client.New("127.0.0.1:4000")
	if err != nil {
		panic(err)
	}
	defer c.Close()

	res := c.Get("key")
	if res.Err() != nil {
		panic(res.Err())
	}

	if res.IsNil() {
		fmt.Print("key does not exist")
	} else {
		fmt.Println(res.Int64())
	}
}

本文来自云栖社区合作伙伴“开源中国”

本文作者:局长

原文链接


【云栖快讯】阿里云双11巅峰钜惠!组团拉新分200万红包,云主机仅99.5元!更可参与百团大战PK,抢百万现金!马上拼团!  详情请点击 评论 (0) 点赞 (0) 收藏 (0)
分享到:

相关文章

网友评论