# PgCacheOptions interface · @imqueue/pg-cache

Source: https://imqueue.org/api/pg-cache/latest/pg-cache.pgcacheoptions/
Published: 2026-08-04
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/pg-cache 5.0.6 — generated reference, not hand-written

Options for the [PgCache()](https://imqueue.org/api/pg-cache/latest/pg-cache.pgcache/) class decorator: where PostgreSQL and redis live, and how the change-notify triggers behave.

Exactly one of `redis` or `redisCache` must be supplied — `redis` to let the decorator build its own connection, `redisCache` to reuse one the service already owns.

**Signature:**

```typescript
export interface PgCacheOptions 
```

## Properties


| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [postgres](https://imqueue.org/api/pg-cache/latest/pg-cache.pgcacheoptions.postgres/) |  | string | PostgreSQL database connection string |
| [prefix?](https://imqueue.org/api/pg-cache/latest/pg-cache.pgcacheoptions.prefix/) |  | string | _(Optional)_ Redis cache key prefix to use. If not specified, decorated service class name will be used as prefix by default. |
| [publish?](https://imqueue.org/api/pg-cache/latest/pg-cache.pgcacheoptions.publish/) |  | boolean | _(Optional)_ Pass false, if database channel event should not be published by service to connected clients. By default is enabled = true. |
| [redis?](https://imqueue.org/api/pg-cache/latest/pg-cache.pgcacheoptions.redis/) |  | { host: string; port: number; username?: string; password?: string; } | _(Optional)_ Redis connection options |
| [redisCache?](https://imqueue.org/api/pg-cache/latest/pg-cache.pgcacheoptions.rediscache/) |  | RedisCache | _(Optional)_ Initialized redis cache instance. One of redis option or this redisCache option is required to be provided |
| [triggerDefinition?](https://imqueue.org/api/pg-cache/latest/pg-cache.pgcacheoptions.triggerdefinition/) |  | string | _(Optional)_ SQL definition of the trigger function, in case default which is used by this lib is not satisfying for some reason. Expected string starting with 'create function post\_change\_notify\_trigger() returns trigger' or will fall back to a default trigger definition. Spaces and case is ignored, 'or replace statement is allowed', if needed. |

