Skip to content

Latest commit

 

History

History
32 lines (21 loc) · 529 Bytes

cache.md

File metadata and controls

32 lines (21 loc) · 529 Bytes

Cache Module

Allows caching inbound responses for paths decorated with @Cache().


Usage

Add the @Cache() to target controller method:

import { Cache, Controller, Get } from '@bechara/crux';

@Controller('foo')
export class FooController {

  public constructor(
    private readonly fooService: FooService,
  ) { }

  @Cache({ ttl: 60_000 })
  @Get(':id')
  public getFoo(@Param('id') id: string): Promise<Foo> {
    return this.fooService.getFooById(id);
  }

}

Back to title