Code Monkey home page Code Monkey logo

aerospiker's Introduction

aerospiker

Build Status

This is a Aerospike client implementation for scala.

It is just a wrapper to aerospike-java-client

Example

package org.aerospiker

import scala.concurrent.duration._
import scala.concurrent.Await
import scala.concurrent.ExecutionContext.Implicits.global

object Main extends App {

  val settings = Settings(
    host = "127.0.0.1:3000",
    user = "",
    pwd = "",
    maxRetries = 3)

  val client = Client(settings)
  val key = new Key("test", "teste", "testee")

  { // String
    val bin = new Bin("nickname", new Value("tkrs"))
    val f = client.put(key, bin).run
    f onSuccess {
      case msg => println("string put done")
    }
    Await.result(f, Duration(100, "millis"))
  }

  { // List
    val bin = new Bin("addr", new Value(List("tokyo", "japan")))
    val f = client.put(key, bin).run
    f onSuccess {
      case msg => println("list put done")
    }
    Await.result(f, Duration(1000, "millis"))
  }

  { // Map
    import java.util.ArrayList
    var arr = new ArrayList[String]()
    val n: String = null
    Array("scala", "rust", n, "haskell") foreach (arr.add(_))
    val key = new Key("test", "teste", "testee")
    val bin = new Bin("attribute", new Value(Map("gender" -> "man", "age" -> "30", "lang" -> arr)))
    val f = client.put(key, bin).run
    f onSuccess {
      case msg => println("map put done")
    }
    Await.result(f, Duration(1000, "millis"))
  }

  {
    val f = client.get(key).run
    f onSuccess {
      case msg => println(msg)
    }
    Await.result(f, Duration(1000, "millis"))
  }
  client.close()

}

Support

Operation

  • get

  • put

DataType

  • Integer

  • String

  • Map (nested)

  • List (nested)

TODO

  • More support operation

  • Test

  • Document

  • Benchmark

  • Erasure to warning

aerospiker's People

Watchers

 avatar  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.