This is a sample app to check whether the a9s Redis service is working or not.
Make sure you installed GO on your machine, download this for mac.
Download the application
$ go get github.com/anynines/a9s-redis-app
$ cd $GOPATH/src/github.com/anynines/a9s-redis-app
Create a service on the a9s PaaS
$ cf create-service a9s-redis40 redis-single-non-persistent-small myredis
Push the app
$ cf push --no-start
Bind the app
$ cf bind-service redis-app myredis
And start
$ cf start redis-app
At last check the created url...
Start Redis service with Docker:
$ docker run -d -p 6379:6379 redis redis-server --requirepass secret
Export a few environment variables and run the sample app:
$ export REDIS_HOST=localhost
$ export REDIS_PORT=6379
$ export REDIS_PASSWORD=secret
$ export APP_DIR=$PWD
$ go build
$ ./a9s-redis-app
To bind the app to other Redis services than a9s-redis50
, have a look at the VCAPServices
struct.