mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-19 08:31:43 +03:00
21 lines
594 B
JavaScript
21 lines
594 B
JavaScript
|
/**
|
||
|
* This is a cache provider that lives very short in memory, there is no need for persistence.
|
||
|
* It is created when scheduling an email in the batch sending service, and is then passed to the sending service. The sending service
|
||
|
* can optionally use a passed cache provider to reuse the email body for each batch with the same segment.
|
||
|
*/
|
||
|
class EmailBodyCache {
|
||
|
constructor() {
|
||
|
this.cache = new Map();
|
||
|
}
|
||
|
|
||
|
get(key) {
|
||
|
return this.cache.get(key) ?? null;
|
||
|
}
|
||
|
|
||
|
set(key, value) {
|
||
|
this.cache.set(key, value);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = EmailBodyCache;
|