feat(medusa): Cache modules (#3187)

This commit is contained in:
Frane Polić
2023-03-10 15:09:26 +01:00
committed by GitHub
parent f43f03badb
commit f97b3d7cce
42 changed files with 783 additions and 186 deletions
+4 -7
View File
@@ -1,8 +1,5 @@
import {
CacheService,
EventBusService,
ProductVariantService,
} from "../services"
import { EventBusService, ProductVariantService } from "../services"
import { ICacheService } from "../interfaces"
type ProductVariantUpdatedEventData = {
id: string
@@ -12,7 +9,7 @@ type ProductVariantUpdatedEventData = {
class PricingSubscriber {
protected readonly eventBus_: EventBusService
protected readonly cacheService_: CacheService
protected readonly cacheService_: ICacheService
constructor({ eventBusService, cacheService }) {
this.eventBus_ = eventBusService
@@ -23,7 +20,7 @@ class PricingSubscriber {
async (data) => {
const { id, fields } = data as ProductVariantUpdatedEventData
if (fields.includes("prices")) {
await this.cacheService_.invalidate(`ps:${id}*`)
await this.cacheService_.invalidate(`ps:${id}:*`)
}
}
)