fix(datasource:adoptium-java): add caching (#11110)

This commit is contained in:
Michael Kriese 2021-08-05 14:34:02 +02:00 committed by GitHub
parent ef069c469e
commit 464b18bacc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,5 @@
import { ExternalHostError } from '../../types/errors/external-host-error'; import { ExternalHostError } from '../../types/errors/external-host-error';
import { cache } from '../../util/cache/package/decorator';
import { HttpError } from '../../util/http/types'; import { HttpError } from '../../util/http/types';
import { Datasource } from '../datasource'; import { Datasource } from '../datasource';
import type { GetReleasesConfig, ReleaseResult } from '../types'; import type { GetReleasesConfig, ReleaseResult } from '../types';
@ -18,6 +19,10 @@ export class AdoptiumJavaDatasource extends Datasource {
caching = true; caching = true;
@cache({
namespace: `datasource-${datasource}`,
key: ({ registryUrl }: GetReleasesConfig) => `${registryUrl}`,
})
async getReleases({ async getReleases({
registryUrl, registryUrl,
}: GetReleasesConfig): Promise<ReleaseResult | null> { }: GetReleasesConfig): Promise<ReleaseResult | null> {