Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cache-redis): add support to nestjs v10 #218

Merged
merged 10 commits into from
Oct 26, 2023
7 changes: 2 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"editor.formatOnSave": true,
"prettier.enable": true
"cSpell.words": [
"NATS"
],
"prettier.enable": true,
"prettier.requireConfig": false
}
}
17 changes: 8 additions & 9 deletions plugins/cache-redis/.amplicationrc.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"settings": {
"host": "localhost",
"port": 6379,
"ttl": 5,
"max": 100,
"username": "",
"password": ""
}
}
"settings": {
"host": "localhost",
"port": 6379,
"ttl": 5000,
"username": "",
"password": ""
}
}
21 changes: 21 additions & 0 deletions plugins/cache-redis/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Change Log

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [2.0.0]

This version:

- adds support for DSG v2+ and Nestjs v10+
- moved to `ioredis` base library instead of `redis` as base library to integrate with Redis

### Changes

<li> <a href="http://github.com/amplication/plugins/commit/f77aaf8b376872935d8665c4fb0768f5017e6bfd">f77aaf8 &bull;</a> chore(cache-redis): update dependencies and webpack config</li>
<li> <a href="http://github.com/amplication/plugins/commit/4948fcbba2c9359913924ffa1d83fee9a32404a0">4948fcb &bull;</a> docs(cache-redis): update readme with link to documentation</li>
<li> <a href="http://github.com/amplication/plugins/commit/00d84b8ce1c7561f6fab94e01b8ef54ffdfc04ec">00d84b8 &bull;</a> feat(cache-redis): add support for nestjs 10</li>
<li> <a href="http://github.com/amplication/plugins/commit/9124ea840e7ea9ec02ff3c5a8f95838cf51f38e5">9124ea8 &bull;</a> feat(cache-redis): use latest redis docker images</li>
<li> <a href="http://github.com/amplication/plugins/commit/579d026ed28fa7ef00bea811253e12c563e7e793">579d026 &bull;</a> chore(cache-redis): move to ioredis client library</li>
21 changes: 10 additions & 11 deletions plugins/cache-redis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ Use a Redis cache in the service generated by Amplication.
This plugin adds the required code to use Redis as a cache in the service generated by Amplication.

It updates the following parts:

- Adds the required dependencies to `package.json`.
- Adds the required environment variables to `.env`.
- Adds the `CacheModule` configured to use Redis to the `app.module.ts` module imports list.
- Adds the required service to the `docker-compose.yml` file.

## Configuration

The `host` setting is the host of the Redis server.
The `host` setting is the host of the Redis server.

The `port` setting is the port on which the Redis server is accepting connections.

Expand All @@ -32,12 +33,11 @@ If no configuration is provided the .amplicationrc.json file will use be used as

```json
{
"host": "localhost",
"port": 6379,
"ttl": 5,
"max": 100,
mulygottlieb marked this conversation as resolved.
Show resolved Hide resolved
"username": null,
"password": null
"host": "localhost",
"port": 6379,
"ttl": 5000,
"username": null,
"password": null
}
```

Expand All @@ -57,16 +57,15 @@ Running `npm run test` will run the plugin's test suite.

## Usage

This plugin provides you with a Redis cache module that you can use in your service.
This plugin provides you with a Redis cache module that you can use in your service as described here: https://docs.nestjs.com/techniques/caching#interacting-with-the-cache-store.

To configure, set the following environment variables:

REDIS_HOST - The host on which the Redis server is running.

REDIS_PORT - The port on which the Redis server is listening.

REDIS_TTL - The Time To Live for cached requests on the Redis server.

REDIS_MAX_REQUESTS_CACHED - The largest amount of requests that can be cached at once.
mulygottlieb marked this conversation as resolved.
Show resolved Hide resolved
REDIS_TTL - The default Time To Live, in milliseconds, for cached requests on the Redis server.

REDIS_USERNAME - The username to be used to connect to the Redis server.

Expand Down
Loading
Loading