https://github.com/abhirockzz/fn-redis-example
Go and Java Fn functions talking to Redis
https://github.com/abhirockzz/fn-redis-example
docker faas golang java serverless
Last synced: 8 months ago
JSON representation
Go and Java Fn functions talking to Redis
- Host: GitHub
- URL: https://github.com/abhirockzz/fn-redis-example
- Owner: abhirockzz
- Created: 2018-07-04T15:46:12.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-07-14T15:33:43.000Z (over 7 years ago)
- Last Synced: 2025-06-02T17:27:13.225Z (10 months ago)
- Topics: docker, faas, golang, java, serverless
- Language: Java
- Size: 5.86 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
- `fn start`
- `export FN_API_URL=http://localhost:8080` //if you're using Docker Tools on Windows, this might be `http://192.168.99.100:8080`
- start Redis `docker run -it --rm --name redis -p 6379:6379 redis`
- update `config` section in `func.yaml` for `create` and `read` apps to specify Redis host and port e.g. `192.168.99.100:6379`
- `cd fn-redis-example`
- `fn deploy create --local --app fnredis`
- `fn deploy read --local --app fnredis`
- set key in Redis `curl -d '{"key":"foo", "val":"bar"}' http://localhost:8080/r/fnredis/create`
- you'll see an output similar to `Redis SET result - OK. Jedis object hash code - 2025269734` (notice the `Jedis` hash code - it will be the same across different invocations, thanks to `hot functions`)
- get value (above key) from Redis - `curl -d 'foo' http://localhost:8080/r/fnredis/read`
- you'll see an output similar to `value for key foo is bar[Wed Jul 10 15:26:32 UTC 2018]` (the content between `[]` is the time when the key was added)