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
| private void get(RoutingContext routingContext) { | |
| long start = System.nanoTime(); | |
| String userId = String.valueOf(new Random().nextInt(1000000)); | |
| String redisKey = "{" + userId + "}" + userId; | |
| RFuture<String> async = RedisClient.getRedisClient().<String>getBucket(redisKey).getAsync(); | |
| async.onComplete((val, throwable) -> { | |
| long end = System.nanoTime(); |
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 main | |
| import ( | |
| "encoding/json" | |
| "fmt" | |
| "math/rand" | |
| "net/http" | |
| "time" | |
| "goji.io" |
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
| FROM golang:latest | |
| RUN mkdir /app | |
| ADD . /app/ | |
| WORKDIR /app | |
| RUN go build -o my_app . | |
| EXPOSE 8099 | |
| CMD ["/app/my_app"] |
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
| var rdb *redis.ClusterClient | |
| func main() { | |
| mux := goji.NewMux() | |
| mux.HandleFunc(pat.Get("/hello/:name"), hello) | |
| mux.HandleFunc(pat.Get("/get"), get) | |
| rdb = createRedis() | |
| http.ListenAndServe(":8099", mux) |
OlderNewer