Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
feat(general): Remove caching instances (#3105)
Browse files Browse the repository at this point in the history
  • Loading branch information
JForsaken committed Dec 7, 2023
1 parent 393fce9 commit d15be17
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 13 deletions.
4 changes: 0 additions & 4 deletions src/apps/angle/common/angle.api.ts
Expand Up @@ -68,7 +68,6 @@ export class AngleApiHelper {
}

@Cache({
instance: 'business',
key: (network: Network) => `studio:angle:apr:${network}:angle`,
ttl: 15 * 60,
})
Expand All @@ -77,7 +76,6 @@ export class AngleApiHelper {
}

@Cache({
instance: 'business',
key: (network: Network) => `studio:angle:vaultmanagers:${network}:angle`,
ttl: 15 * 60,
})
Expand All @@ -86,7 +84,6 @@ export class AngleApiHelper {
}

@Cache({
instance: 'user',
key: (network: Network) => `studio:angle:vaults:${network}:angle`,
ttl: 15 * 60,
})
Expand All @@ -102,7 +99,6 @@ export class AngleApiHelper {
}

@Cache({
instance: 'user',
key: (network: Network) => `studio:angle:rewardsdata:${network}:angle`,
ttl: 30 * 60,
})
Expand Down
Expand Up @@ -144,7 +144,6 @@ export abstract class HomoraV2FarmContractPositionFetcher extends CustomContract
}

@Cache({
instance: 'business',
key: (network: Network) => `studio:homora-v2:${network}:positions-data`,
ttl: 3 * 60,
})
Expand Down
1 change: 0 additions & 1 deletion src/apps/polynomial/common/polynomial.api.ts
Expand Up @@ -21,7 +21,6 @@ export class PolynomialApiHelper {
}

@Cache({
instance: 'business',
key: () => `studio:polynomial:vaults`,
ttl: 15 * 60,
})
Expand Down
2 changes: 0 additions & 2 deletions src/apps/ren/common/ren.api.client.ts
Expand Up @@ -11,7 +11,6 @@ export class RenApiClient {
constructor(@Inject(APP_TOOLKIT) protected readonly appToolkit: IAppToolkit) {}

@Cache({
instance: 'business',
key: () => `studio:ren:darknode:assets`,
ttl: 5 * 60, // 5 minutes
})
Expand All @@ -25,7 +24,6 @@ export class RenApiClient {
}

@Cache({
instance: 'user',
key: (address: string) => `studio:ren:darknode:${address}:darknodes`,
ttl: 5 * 60, // 5 minutes
})
Expand Down
1 change: 0 additions & 1 deletion src/apps/robo-vault/common/robo-vault.api.client.ts
Expand Up @@ -14,7 +14,6 @@ export type RoboVaultDetails = {
@Injectable()
export class RoboVaultApiClient {
@Cache({
instance: 'business',
key: (network: Network) => `studio:robovault:${network}:vaults`,
ttl: 30 * 60,
})
Expand Down
Expand Up @@ -45,7 +45,6 @@ export class SynthetixMintrSnxHoldersCache {
};

@Cache({
instance: 'business',
key: (network: Network) => `studio:synthetix:${network}:all-snx-holders`,
ttl: moment.duration('15', 'minutes').asSeconds(),
})
Expand Down
4 changes: 1 addition & 3 deletions src/cache/cache.decorator.ts
Expand Up @@ -6,18 +6,16 @@ type CacheKeyBuilder = (...args: any) => string;
type CacheTtlBuilder = (...args: any) => number;

export type CacheOptions = {
instance?: 'user' | 'business';
key: string | CacheKeyBuilder;
/** In seconds */
ttl?: number | CacheTtlBuilder;
};

export const Cache = ({ key, ttl, instance }: CacheOptions) => {
export const Cache = ({ key, ttl }: CacheOptions) => {
return applyDecorators(
SetMetadata(CACHE_DECORATOR, {
key,
ttl,
instance: instance || 'business',
}),
);
};

0 comments on commit d15be17

Please sign in to comment.