- Install & Setup New Relic
cd my_rails_project/config/initializers
wget http://raw.github.com/gist/2933202/5adcf11839c0ef2064a5f0c6e0fe795d9ed2c60a/couchbase_new_relic_instrumentation.rb
git add
and deploy as usual!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Simple two-phase commit for PHP couchbase. | |
* | |
* Michael Nitschinger (@daschl, 2012) | |
* | |
* Additional Remarks | |
* ------------------ | |
* - The Couchbase extension makes it currently pretty hard to write easy readable code when dealing with | |
* CAS (compared to the ruby adapter). This could certainly be improved with closures. I also found that |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DATA_TYPE | |
========= | |
+---------------+ | |
|7 6 5 4 3 2 1 0| | |
+---------------+ | |
00000000: RAW_BYTES | |
0-2: Serializers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import couchbase | |
cb = couchbase.Server("192.168.1.131:8091", "", "") | |
bucket = cb.bucket("default") | |
rows = bucket.view("_design/breweries/_view/all_breweries") | |
for row in rows: | |
print row |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import couchbase | |
cb = couchbase.Server("127.0.0.11:8091", "", "") | |
bucket = cb.bucket("default") | |
bucket.set("foo", 0, 0, "bar") | |
print bucket.get("foo") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GistID: 1924422 | |
# Author:: Couchbase <[email protected]> | |
# Copyright:: 2011, 2012 Couchbase, Inc. | |
# License:: Apache License, Version 2.0 | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.InetSocketAddress; | |
import java.util.concurrent.Executors; | |
import org.jboss.netty.bootstrap.ClientBootstrap; | |
import org.jboss.netty.buffer.ChannelBuffer; | |
import org.jboss.netty.buffer.ChannelBuffers; | |
import org.jboss.netty.channel.ChannelHandlerContext; | |
import org.jboss.netty.channel.ChannelPipeline; | |
import org.jboss.netty.channel.ChannelPipelineFactory; | |
import org.jboss.netty.channel.Channels; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$cb = new Couchbase; | |
$cb->addServer("localhost", 11211); // BC compat | |
$view = $cb->getView("ddocname", "viewname"); // returns Couchbase_View | |
$result = $view->getResult(); // returns Couchbase_ViewResult | |
foreach($result->rows AS $row) { | |
echo $row->value; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=========== | |
Examples: | |
=========== | |
CouchbaseClient couchbase_client = new CouchbaseClient(Arrays.asList(URI.create("http://localhost:8091/pools")), "default", ""); | |
// Get views from a design document | |
List<View> views = couchbase_client.getViews("design_doc_name"); | |
// Get a single view from the server |