-
Notifications
You must be signed in to change notification settings - Fork 12
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
Feature/cache module #156
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Please merge in latest
main
- 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 |
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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
)
private getExpirationDate(expiresIn: string) { | ||
const now = new Date(); | ||
|
||
// add time in seconds to now as string format | ||
return new Date(now.getTime() + ms(expiresIn)); | ||
} | ||
} |
There was a problem hiding this comment.
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?
private getExpirationDate(expiresIn: string) { | ||
const now = new Date(); | ||
|
||
// add time in seconds to now as string format | ||
return new Date(now.getTime() + ms(expiresIn)); | ||
} |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
Created new cache module