# cacheWith() function · @imqueue/pg-cache

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

Decorator factory `@cacheWith`(CacheWithOptions) This decorator should be used on a service methods, to set the caching rules for a method.

**Signature:**

```typescript
export declare function cacheWith(options: CacheWithOptions): MethodDecorator;
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| options | [CacheWithOptions](https://imqueue.org/api/pg-cache/latest/pg-cache.cachewithoptions/) | which channels invalidate the result, its TTL and cache tag |


**Returns:**

[MethodDecorator](https://imqueue.org/api/pg-cache/latest/pg-cache.methoddecorator/)

