mirror of
https://github.com/renovatebot/renovate.git
synced 2026-11-08 13:12:59 +00:00
930cf6633c
fix: Additional vi.mock path corrections and prettier formatting
31 lines
938 B
TypeScript
31 lines
938 B
TypeScript
import * as memCache from '../../../cache/memory/index.ts';
|
|
import type {
|
|
GithubDatasourceItem,
|
|
GithubGraphqlCacheRecord,
|
|
} from '../types.ts';
|
|
import { AbstractGithubGraphqlCacheStrategy } from './abstract-cache-strategy.ts';
|
|
|
|
/**
|
|
* In-memory strategy meant to be used for private packages
|
|
* and for testing purposes.
|
|
*/
|
|
export class GithubGraphqlMemoryCacheStrategy<
|
|
GithubItem extends GithubDatasourceItem,
|
|
> extends AbstractGithubGraphqlCacheStrategy<GithubItem> {
|
|
private fullKey(): string {
|
|
return `github-graphql-cache:${this.cacheNs}:${this.cacheKey}`;
|
|
}
|
|
|
|
load(): Promise<GithubGraphqlCacheRecord<GithubItem> | undefined> {
|
|
const key = this.fullKey();
|
|
const res = memCache.get(key);
|
|
return Promise.resolve(res);
|
|
}
|
|
|
|
persist(cacheRecord: GithubGraphqlCacheRecord<GithubItem>): Promise<void> {
|
|
const key = this.fullKey();
|
|
memCache.set(key, cacheRecord);
|
|
return Promise.resolve();
|
|
}
|
|
}
|