Skip to content

Commit

Permalink
fix(platform-cache): import UseCase from @tsed/platform-cache instead…
Browse files Browse the repository at this point in the history
… of @tsed/common
  • Loading branch information
Romakita committed Nov 28, 2021
1 parent b1241fe commit d6f8a9d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
15 changes: 10 additions & 5 deletions docs/docs/cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ export class Server {}
To interact with the cache manager instance, inject it to your class using the @@PlatformCache@@ token, as follows:

```typescript
import {PlatformCache} from "@tsed/platform-cache";

@Injectable()
export class MyService {
@Inject()
Expand Down Expand Up @@ -126,7 +128,8 @@ await this.cache.reset();
To enable cache on endpoint, use @@UseCache@@ decorator on a method as follows:

```typescript
import {Controller, UseCache, Get, PathParams} from "@tsed/common";
import {Controller, Get, PathParams} from "@tsed/common";
import {UseCache} from "@tsed/platform-cache";

@Controller("/my-path")
export class MyController {
Expand Down Expand Up @@ -159,7 +162,7 @@ Because @@UseCache@@ uses @@PlatformCacheInterceptor@@ and not a middleware, you

```typescript
import {Injectable} from "@tsed/di";
import {UseCache} from "@tsed/common";
import {UseCache} from "@tsed/platform-cache";

@Injectable()
export class MyService {
Expand All @@ -177,7 +180,7 @@ to the UseCache decorator. Ts.ED will use @@deserialize@@ function based on the

```typescript
import {Injectable} from "@tsed/di";
import {UseCache} from "@tsed/common";
import {UseCache} from "@tsed/platform-cache";

@Injectable()
export class MyService {
Expand Down Expand Up @@ -218,7 +221,8 @@ import {PlatformContext} from "@tsed/common";
The second way is to use the `key` option with @@UseCache@@ decorator:

```typescript
import {Controller, UseCache, Get, PathParams, PlatformContext} from "@tsed/common";
import {Controller, Get, PathParams, PlatformContext} from "@tsed/common";
import {UseCache} from "@tsed/platform-cache";

@Controller("/my-path")
export class MyController {
Expand All @@ -241,7 +245,8 @@ export class MyController {
TTL can be defined per endpoint with @@UseCache@@:

```typescript
import {Controller, UseCache, Get, PathParams, PlatformContext} from "@tsed/common";
import {Controller, Get, PathParams, PlatformContext} from "@tsed/common";
import {UseCache} from "@tsed/platform-cache";

@Controller("/my-path")
export class MyController {
Expand Down
1 change: 0 additions & 1 deletion packages/platform/common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export * from "@tsed/di";
export * from "@tsed/platform-params";
export * from "@tsed/platform-exceptions";
export * from "@tsed/platform-response-filter";
export * from "@tsed/platform-cache";
export * from "@tsed/platform-middlewares";
export * from "@tsed/components-scan";
export * from "@tsed/platform-log-middleware";
Expand Down
3 changes: 2 additions & 1 deletion packages/platform/platform-test-utils/src/tests/testCache.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {Controller, Get, Head, Inject, PathParams, PlatformCache, PlatformTest, Post, QueryParams, UseCache} from "@tsed/common";
import {Controller, Get, Head, Inject, PathParams, PlatformTest, Post, QueryParams} from "@tsed/common";
import {Property} from "@tsed/schema";
import {PlatformCache, UseCache} from "@tsed/platform-cache";
import {expect} from "chai";
import SuperTest from "supertest";
import {PlatformTestOptions} from "../interfaces";
Expand Down

0 comments on commit d6f8a9d

Please sign in to comment.