Spaces:
Sleeping
Sleeping
Scott Hiett
commited on
Commit
·
ef22da3
1
Parent(s):
d290264
Doc updates
Browse files
README.md
CHANGED
|
@@ -1,11 +1,43 @@
|
|
| 1 |
# SRH: Serverless Redis HTTP
|
| 2 |
-
A
|
| 3 |
while also not having to worry about the Redis max connection limits.
|
| 4 |
|
| 5 |
-
|
|
|
|
| 6 |
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# SRH: Serverless Redis HTTP
|
| 2 |
+
A Redis connection pooler for serverless applications. This allows your serverless functions to talk to Redis via HTTP,
|
| 3 |
while also not having to worry about the Redis max connection limits.
|
| 4 |
|
| 5 |
+
The idea is you host this alongside your Redis server, so minimise latency. The serverless functions can then talk to
|
| 6 |
+
this via HTTP.
|
| 7 |
|
| 8 |
+
## Features
|
| 9 |
+
- Allows you to talk to redis via HTTP
|
| 10 |
+
- Pools redis connections
|
| 11 |
+
- Automatically kills redis connections after inactivity
|
| 12 |
+
- Supports multiple redis instances, and you can configure unique tokens for each
|
| 13 |
+
- Fully supports the `@upstash/redis` TypeScript library.
|
| 14 |
|
| 15 |
+
## Client usage
|
| 16 |
+
This will not work with regular Redis clients, as it is over HTTP and not the redis protocol.
|
| 17 |
+
However, to try and keep the project as "standardised" as possible, you can use the `@upstash/redis` TypeScript library.
|
| 18 |
+
You can read about it here: [Upstash Redis GitHub](https://github.com/upstash/upstash-redis)
|
| 19 |
|
| 20 |
+
Soon I will add specific documentation for the endpoints so you can implement clients in other languages.
|
| 21 |
+
|
| 22 |
+
## Installation
|
| 23 |
+
Soon, I will provide a Docker container for this. Right now, you need Elixir 1.13+ installed. Clone down the repo, then run:
|
| 24 |
+
`mix deps.get`
|
| 25 |
+
then
|
| 26 |
+
`iex -S mix`
|
| 27 |
+
|
| 28 |
+
To configure Redis targets:\
|
| 29 |
+
Create a file: `srh-config/tokens.json`
|
| 30 |
+
```json
|
| 31 |
+
{
|
| 32 |
+
"example_token": {
|
| 33 |
+
"srh_id": "some_unique_identifier",
|
| 34 |
+
"connection_string": "redis://localhost:6379",
|
| 35 |
+
"max_connections": 3
|
| 36 |
+
}
|
| 37 |
+
}
|
| 38 |
+
```
|
| 39 |
+
Notes:
|
| 40 |
+
- Srh_id can be anything you want, as long as it's a string, and unique.
|
| 41 |
+
- `max_connections` is the maximum number of connections for the pool.
|
| 42 |
+
- If there is inactivity, the pool will kill these connections. They will only be open while the pool is alive. The pool will re-create these connections when commands come in.
|
| 43 |
+
- You can add more redis instances to connect to by adding more tokens and connection configurations. Based on the header in each request, the correct pool/connection info will be used.
|