How to use redis based-session on Revel?
I found this gist, but didn't know how to use it..
EDIT #1:
my env variable
GOROOT --> /usr/lib/go
GOPATH --> /home/asd/Dropbox/go
what i've done:
mkdir -p $GOPATH/src/myapp/app/libs/session
curl https://gist.githubusercontent.com/xthexder/9026678/raw/9e40fb56d8991de945a2064b6869bb7280b1305a/session.go \
> $GOPATH/src/myapp/app/libs/session/session.go
go get github.com/garyburd/redigo
go get github.com/robfig/revel
add import "myapp/app/libs/session"
on init.go
, and this error show up:
Go Compilation Error
The Go code Dropbox/go/src/myapp/app/libs/session/session.go does not compile: undefined: Redis
In Dropbox/go/src/myapp/app/libs/session/session.go (around line 75)
70: panic("Session values may not have null bytes")
71: }
72: sessionValue += "\x00" + key + ":" + value + "\x00"
73: }
74:
75: redisConn := Redis.Get()
76: defer redisConn.Close()
77:
78: params := []interface{}{"session:" + sessionToken, sessionValue}
79: if expireAfterDuration != 0 {
the error on the console:
WARN 2014/06/11 20:11:15 build.go:132: Cannot determine git repository version: exit status 128
ERROR 2014/06/11 20:11:15 build.go:84: # myapp/app/libs/session
Dropbox/go/src/myapp/app/libs/session/session.go:75: undefined: Redis
Dropbox/go/src/myapp/app/libs/session/session.go:126: undefined: Redis
Dropbox/go/src/myapp/app/libs/session/session.go:129: not enough arguments in call to redis.String
Dropbox/go/src/myapp/app/libs/session/session.go:172: undefined: Redis
Dropbox/go/src/myapp/app/libs/session/session.go:175: not enough arguments in call to redis.Int