Does Go SDK support memcached type bucket now?


#1

Check the old post, said it’s not supported in 2015, 2 years past, is it OK now?

If now, how can I make development by Go for the memcached type bucket?


#2

Hey @billychb,

Memcached buckets should be fully supported. You can connect to them just like you would a Couchbase bucket. Note that Memcached buckets have a restricted number of supported operations and using operations which are not supported will cause an error to be returned.

Cheers, Brett


#3

Hi Brett,

I have use this as follows according to the sample which couchbase provided:

func main() {
cluster, err := gocb.Connect(“couchbase://localhost”)
if err == nil {
fmt.Println(“connected!”)
} else {
fmt.Println(“connect error:”, err)
}
bucket, err := cluster.OpenBucket(“sessions”, “123456”)
//bucket, err := cluster.OpenBucket(“beer-sample”, “test”)
//bucket, err := cluster.OpenBucket(“default”, “”)
if err == nil {
fmt.Println(“opened!”)
} else {
fmt.Println(“open error:”, err)
}

//bucket.Manager("", “”).CreatePrimaryIndex("", true, false)

bucket.Upsert(“u:kingarthur”,
User{
Id: “kingarthur”,
Email: "kingarthur@couchbase.com",
Interests: []string{“Holy Grail”, “African Swallows”},
}, 10)

// Get the value back
var inUser User
bucket.Get(“u:kingarthur”, &inUser)
fmt.Printf(“User: %v\n”, inUser)
}

It produce the following response:

connected!
open error: failed to connect to any of the specified hosts

or:

connected!
open error: failed to connect to any of the specified hosts

When I use the default or beer-sample like couchbase type bucket, it works fine.


#4

Hey @billychb,

I will investigate this tomorrow morning. It looks like we may have accidentally caused a regression with Memcached buckets in the Go SDK. I have opened an issue to track this in the meantime:
https://issues.couchbase.com/browse/GOCBC-207

P.S. Would you be able to confirm which Go SDK version you are using?

Cheers, Brett


#5

My env:

Go version: 1.8.3
Couchbase SDK version: should be 1.2.3, but I am in master branch.


#6

I just tried 1.2.2, with gocbcore.v6, same result.


#7

Hi Brett,

Any improvement?


#8

Hi Brett,

Another week past.


#9

Hi Brett,

Why the JIRA said can not reproduce??