Skip to content

Commit 22571c1

Browse files
feature: remove expired items for postgres adapter #20 (#21)
Co-authored-by: nwittstruck <nwittstruck@users.noreply.github.com>
1 parent 1cd18f5 commit 22571c1

File tree

8 files changed

+439
-173
lines changed

8 files changed

+439
-173
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ on:
1717
push:
1818
branches:
1919
- main
20+
- 20-feature-remove-expired-items-for-postgres-adapter
2021

2122
env:
2223
REGISTRY: ghcr.io
@@ -51,4 +52,4 @@ jobs:
5152
target: production
5253
push: true
5354
tags: ${{ steps.meta.outputs.tags }}
54-
labels: ${{ steps.meta.outputs.labels }}
55+
labels: ${{ steps.meta.outputs.labels }}

README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,25 @@ It use Keyv as a simple K/V store so you can use the database of your choice.
1818

1919
## Environement Variables
2020

21-
| Name | Description | Default value |
22-
| --------------- | ------------------------------------------------------------ | ---------------- |
23-
| `PORT` | Server listening port | 8080 |
24-
| `GLOBAL_PREFIX` | API global prefix for every routes | `/api/v2` |
25-
| `STORAGE_URI` | [Keyv](https://github.com/jaredwray/keyv) connection string, example: `redis://user:pass@localhost:6379`. Availabe Keyv storage adapter: redis, mongo, postgres and mysql | `""` (in memory **non-persistent**) |
26-
| `STORAGE_TTL` | Time to live for data | null |
27-
| `LOG_LEVEL` | Log level (`debug`, `verbose`, `log`, `warn`, `error`) | `warn` |
28-
| `BODY_LIMIT` | Payload size limit for scenes or images | `50mb` |
21+
| Name | Description | Default value |
22+
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- |
23+
| `PORT` | Server listening port | 8080 |
24+
| `GLOBAL_PREFIX` | API global prefix for every routes | `/api/v2` |
25+
| `STORAGE_URI` | [Keyv](https://github.com/jaredwray/keyv) connection string, example: `redis://user:pass@localhost:6379`. Availabe Keyv storage adapter: redis, mongo, postgres and mysql | `""` (in memory **non-persistent**) |
26+
| `STORAGE_TTL` | Time to live for data | null |
27+
| `LOG_LEVEL` | Log level (`debug`, `verbose`, `log`, `warn`, `error`) | `warn` |
28+
| `BODY_LIMIT` | Payload size limit for scenes or images | `50mb` |
29+
| `ENABLE_POSTGRES_TTL_SERVICE` | Enabling the Postgres TTL Service will clean up expired items once a day. This will break if used with a non-postgres `STORAGE_URI`. | `false` |
2930

3031
### Env Variables for Postgres
32+
3133
For setting postgres pool variables, a few code adjustment have to be made in the `storage.service.ts`:
34+
3235
```typescript
3336
const store = new (require('@keyv/postgres'))({
3437
uri,
35-
max: 1
36-
})
38+
max: 1,
39+
});
3740

3841
const keyv = new Keyv({
3942
store,

0 commit comments

Comments
 (0)