Skip to content

Instantly share code, notes, and snippets.

View brachi-wernick's full-sized avatar

Brachi Packter brachi-wernick

  • moonactive
  • Israel
View GitHub Profile
@brachi-wernick
brachi-wernick / RedisGet.java
Created February 24, 2020 21:24
api to get data from redis
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();
@brachi-wernick
brachi-wernick / main.go
Created February 24, 2020 21:36
GoJi hello world
package main
import (
"encoding/json"
"fmt"
"math/rand"
"net/http"
"time"
"goji.io"
@brachi-wernick
brachi-wernick / Dockerfile
Created February 24, 2020 21:37
go docker file
FROM golang:latest
RUN mkdir /app
ADD . /app/
WORKDIR /app
RUN go build -o my_app .
EXPOSE 8099
CMD ["/app/my_app"]
@brachi-wernick
brachi-wernick / main.go
Created February 24, 2020 21:43
get redis api
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)