GithubHelp home page GithubHelp logo

pombredanne / lightcloud Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mitchellh/lightcloud

1.0 2.0 1.0 100 KB

Library for accessing Plurk's LightCloud distributed key-value store for Ruby

License: BSD 3-Clause "New" or "Revised" License

lightcloud's Introduction

LightCloud Library for Ruby

This is a library for accessing LightCloud systems through Ruby.

Background

LightCloud is a distributed key-value stored open-sourced by Plurk. The official website which includes benchmarks, design specs, and more can be viewed at the following URL:

opensource.plurk.com/LightCloud/

Usage

You can use it with class methods:

require 'rubygems'
require 'lightcloud'

LIGHT_CLOUD = {
  'lookup1_A' => ['127.0.0.1:41401', '127.0.0.1:41402'],
  'storage1_A' => ['192.168.0.2:51401', '192.168.0.2:51402']
}

lookup_nodes, storage_nodes = LightCloud.generate_nodes(LIGHT_CLOUD)
LightCloud.init(lookup_nodes, storage_nodes)

LightCloud.set("hello", "world")
print LightCloud.get("hello") # => world
LightCloud.delete("hello")

print LightCloud.get("hello") # => nil

Or you can also use it with instances:

require 'rubygems'
require 'lightcloud'

LIGHT_CLOUD = {
  'lookup1_A' => ['127.0.0.1:41401', '127.0.0.1:41402'],
  'storage1_A' => ['192.168.0.2:51401', '192.168.0.2:51402']
}

lookup_nodes, storage_nodes = LightCloud.generate_nodes(LIGHT_CLOUD)
cloud = LightCloud.new(lookup_nodes, storage_nodes)

cloud.set("hello", "world")
print cloud.get("hello") # => world
cloud.delete("hello")

print cloud.get("hello") # => nil

Installation

sudo gem install mitchellh-lightcloud

Known Issues / To-Do

The python library actually caches the get/set values in a thread-local hash table. This library doesn’t do this yet but I’m working on adding this in now.

lightcloud's People

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.