在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:aerospike/aerospike-client-go开源软件地址:https://github.com/aerospike/aerospike-client-go开源编程语言:Go 99.9%开源软件介绍:Aerospike Go ClientIMPORTANT NOTEThis is an old version the Aerospike Go Client, which is v4.x.x. The newest version v5 has migrated to go modules,
which required us to put it in the Official Aerospike Client library for Go. This library is compatible with Go 1.9+ and supports the following operating systems: Linux, Mac OS X (Windows builds are possible, but untested). Up-to-date documentation is available in the . You can refer to the test files for idiomatic use cases. Please refer to
UsageThe following is a very simple example of CRUD operations in an Aerospike database. package main
import (
"fmt"
aero "github.com/aerospike/aerospike-client-go"
)
// This is only for this example.
// Please handle errors properly.
func panicOnError(err error) {
if err != nil {
panic(err)
}
}
func main() {
// define a client to connect to
client, err := aero.NewClient("127.0.0.1", 3000)
panicOnError(err)
key, err := aero.NewKey("test", "aerospike", "key")
panicOnError(err)
// define some bins with data
bins := aero.BinMap{
"bin1": 42,
"bin2": "An elephant is a mouse with an operating system",
"bin3": []interface{}{"Go", 2009},
}
// write the bins
err = client.Put(nil, key, bins)
panicOnError(err)
// read it back!
rec, err := client.Get(nil, key)
panicOnError(err)
// delete the key, and check if key exists
existed, err := client.Delete(nil, key)
panicOnError(err)
fmt.Printf("Record existed before delete? %v\n", existed)
} More examples illustrating the use of the API are located in the
Details about the API are available in the PrerequisitesGo version v1.12+ is required. To install the latest stable version of Go, visit http://golang.org/dl/ Aerospike Go client implements the wire protocol, and does not depend on the C client. It is goroutine friendly, and works asynchronously. Supported operating systems:
Installation
Using gopkg.in is also supported: Some Hints:
Performance TweakingWe are bending all efforts to improve the client's performance. In our reference benchmarks, Go client performs almost as good as the C client. To read about performance variables, please refer to TestsThis library is packaged with a number of tests. Tests require Ginkgo and Gomega library. Before running the tests, you need to update the dependencies:
To run all the test cases with race detection:
ExamplesA variety of example applications are provided in the ToolsA variety of clones of original tools are provided in the BenchmarksBenchmark utility is provided in the API DocumentationA simple API documentation is available in the Google App EngineTo build the library for App Engine, build it with the build tag Reflection, and Object APITo make the library both flexible and fast, we had to integrate the reflection API (methods with LicenseThe Aerospike Go Client is made available under the terms of the Apache License, Version 2, as stated in the file Individual files may be made available under their own specific license, all compatible with Apache License, Version 2. Please see individual files for details. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论