微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Tarantool 嵌入式 NoSQL 数据库

程序名称:Tarantool

授权协议: BSD

操作系统: 跨平台

开发语言: Lua

Tarantool 介绍

Tarantool 是一个用 Lua 语言编写的嵌入式 Nosql 数据库,可以直接在 Lua 程序中运行。合并了 Node.js 的强大网络编程和
Redis 数据持久。

示例代码

#!/usr/bin/env tarantool

Box.cfg{}
hosts = Box.space.hosts
if not hosts then
    hosts = Box.schema.create_space('hosts')
    hosts:create_index('primary', { parts = {1, 'STR'} })
end

local function handler(self)
    local host = self.req.peer.host
    local response = {
        host = host;
        counter = hosts:inc(host);
    }
    self:render({ json = response })
end

httpd = require('http.server')
server = httpd.new('127.0.0.1', 8080)
server:route({ path = '/' }, handler)
server:start()

Tarantool 官网

http://tarantool.org/

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐