Hmm... do I have to do something more after running TRAVIS_SCALA_VERSION=2.11.7 ./bin/travisci
because the import thriftscala
isn't working.
This file contains hidden or 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
public static void main(String[] args) throws Exception { | |
HandleErrors errorsFilter = new HandleErrors(); | |
Service<Request, Response> service = errorsFilter.andThen(router()); | |
ListeningServer server = Http.server().serve(addr, service); | |
Await.ready(server); | |
} |
This file contains hidden or 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
public final class HandleErrors extends SimpleFilter<Request, Response> { | |
@Override | |
public Future<Response> apply(Request req, Service<Request, Response> service) { | |
return service.apply(req).handle(new ExceptionalFunction<Throwable, Response>() { | |
@Override | |
public Response applyE(Throwable in) { | |
Response resp = Response.apply(); | |
ChannelBuffer content = ChannelBuffers.wrappedBuffer(in.getMessage().getBytes()); | |
if (in instanceof NumberFormatException) { |
This file contains hidden or 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
public class HttpServer { | |
static InetSocketAddress addr = new InetSocketAddress(InetAddress.getLoopbackAddress(), 8888); | |
public static void main(String[] args) throws Exception { | |
Service<Request, Response> service = router(); | |
ListeningServer server = Http.server().serve(addr, service); | |
Await.ready(server); |
This file contains hidden or 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
public static void main(String[] args) throws Exception { | |
HandleErrors errorsFilter = new HandleErrors(); | |
Service<Request, Response> service = errorsFilter.andThen(router()); | |
ListeningServer server = Http.server().serve(addr, service); | |
Await.ready(server); | |
} |
This file contains hidden or 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
package com.leon.dogs; | |
import com.twitter.finagle.ListeningServer; | |
import com.twitter.finagle.Service; | |
import com.twitter.finagle.http.HttpMuxer; | |
import com.twitter.finagle.http.Request; | |
import com.twitter.finagle.http.Response; | |
import com.twitter.util.Await; | |
import com.twitter.util.Future; | |
import org.jboss.netty.buffer.ChannelBuffers; |
This file contains hidden or 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
package com.lm.newrelic | |
import com.newrelic.api.agent.{NewRelic, Trace} | |
import scala.reflect.macros.whitebox | |
import language.experimental.macros | |
import scala.annotation.{compileTimeOnly, StaticAnnotation} | |
class transaction(category: String, name: String) extends StaticAnnotation { | |
def macroTransform(annottees: Any*) = macro traceMacro.transaction_impl |
The example key you give is for a set, set lookup methods are O(1). The more complex operations on a set (SDIFF, SUNION, SINTER) are O(N). Chances are that populating $userId
was a more expensive operation than using a longer key.
Redis comes with a benchmark utility called redis-benchmark
, if you modify the "GET" test in src/redis-benchmark.c so that they key is just "foo", you can run the short key test after a make install
:
diff --git a/src/redis-benchmark.c b/src/redis-benchmark.c
--- a/src/redis-benchmark.c
+++ b/src/redis-benchmark.c
@@ -475,11 +475,11 @@
benchmark("MSET (10 keys)",cmd,len);
free(cmd);
This file contains hidden or 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
merchants_guide_to_the_galaxy | |
============================= | |
##Instructions: | |
The program input must be at the input.txt file | |
The output will be printed at the output.txt file | |
1. go to the folder and run the console.rb file | |
$ ruby console.rb |