# CacheByOptions interface · @imqueue/pg-cache

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

Options expected by `@cacheBy`() decorator factory

**Signature:**

```typescript
export interface CacheByOptions 
```

## Properties


| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [fieldsArg?](https://imqueue.org/api/pg-cache/latest/pg-cache.cachebyoptions.fieldsarg/) |  | number | _(Optional)_ Zero-index based position of fields argument in a method arguments, which are passed at runtime. Fields argument are usually passed from a client to specify a query map to be extracted and returned from a service method. For example, fields map can be built from an incoming GraphQL request using fieldsMap() function from graphql-fields-list package. Usually pg-based `@imqueue` services, which utilize `@imqueue/pg-sequelize` package passing fields as a second argument to service methods, so if this option is omitted, it will try to check for the second passed argument. If you need to explicitly disable it, pass -1. |
| [ttl?](https://imqueue.org/api/pg-cache/latest/pg-cache.cachebyoptions.ttl/) |  | number | _(Optional)_ Time to live for cached values. If not specified - default is used. Default is equivalent of 24 hours. Must be specified in milliseconds. |

