Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Simple caching examples with Redis and Node.js!
- SQLite
- SQLite3
- Redis
- Docker

## Installing this application

Expand All @@ -33,13 +34,29 @@ $ npm install

Ensure you have Redis installed and running.

For Docker:
You can run it with Docker:

```bash
$ docker run -p 6379:6379 --name redis6 -d redis:6
$ docker-compose up -d
```

Ensure you have SQLite3 installed.
You can also run redis-cli in the container
```bash
$ docker exec -it redis-caching-slow-database-queries redis-cli
```
> NOTE: If you're using Redis Enterprise Cloud, you'll need the hostname, port number, and password for your database. Use these to set the `REDIS_OM_URL` environment variable like this:

```bash
$ export REDIS_OM_URL=redis://default:<password>@<host>:<port>
```

(**This step is not required when working with Docker as the Docker container** runs Redis on `localhost` port `6379` with no password, which is the default connection that Redis OM uses.)

For example if your Redis Enterprise Cloud database is at port `9139` on host `enterprise.redis.com` and your password is `5uper53cret` then you'd set `REDIS_OM_URL` as follows:

> You can also use redis-stack on your browser

> Ensure you have SQLite3 installed.

### Unzip and import data to the SQLite `weather` table:

Expand Down Expand Up @@ -91,4 +108,9 @@ $ node average.js
responseTime: '2ms'
}
```
## Shutting Down Redis (Docker)

If you're using Docker, and want to shut down the Redis container when you are finished with the application just use:
```bash
$ docker-compose down
```
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: "3.9"
services:
redis:
container_name: redis-caching-slow-database-queries
image: "redis/redis-stack:latest"
ports:
- 6379:6379
- 8001:8001
deploy:
restart_policy:
condition: on-failure