Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache GitLab responses to avoid spamming the GitLab server #126

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use es6 syntactical sugar
dejan9393 committed Apr 15, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 99c0119fb0b41becdde4edb604a239a49cb04cd6
6 changes: 2 additions & 4 deletions src/gitlabcache.ts
Original file line number Diff line number Diff line change
@@ -11,13 +11,11 @@ export class GitlabCache {
private ttl: number;
private storage: NodeCache;

public static get DEFAULT_TTL() {
return 300;
}
public static readonly DEFAULT_TTL = 300;

private static _generateKeyHash(username: string, password: string) {
const sha = Crypto.createHash('sha256');
sha.update(JSON.stringify({ username: username, password: password }));
sha.update(JSON.stringify({ username, password }));
return sha.digest('hex');
}