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

Feature/cache module #156

Merged
merged 6 commits into from
Jun 4, 2024
Merged

Conversation

tnramalho
Copy link
Collaborator

Created new cache module

Copy link
Collaborator

@MrMaz MrMaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Please merge in latest main
  2. I think we should add a custom callback validation function in settings which receives the json object, let's discuss

import { format } from 'util';
import { ExceptionInterface } from '@concepta/ts-core';

export class AssignmentNotFoundException
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class name should be prefixed with Cache

export const cacheDefaultConfig = registerAs(
CACHE_MODULE_DEFAULT_SETTINGS_TOKEN,
(): Partial<CacheSettingsInterface> => ({
expiresIn: process.env.CACHE_EXPIRE_IN ? process.env.CACHE_EXPIRE_IN : '1d',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should support no expiration date and default is to not expire (undefined)

Comment on lines 197 to 203
private getExpirationDate(expiresIn: string) {
const now = new Date();

// add time in seconds to now as string format
return new Date(now.getTime() + ms(expiresIn));
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate method in cache service, should be utility?

Comment on lines 311 to 316
private getExpirationDate(expiresIn: string) {
const now = new Date();

// add time in seconds to now as string format
return new Date(now.getTime() + ms(expiresIn));
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate method in cache controller, should be utility?

*/
@Exclude()
export class CacheUpdateDto
extends PickType(CacheDto, ['key', 'type', 'assignee', 'data'] as const)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should discuss if expiresIn should be allowed again if they want to reset the expiration

@MrMaz MrMaz merged commit dc28cdb into conceptadev:main Jun 4, 2024
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants