feat(cache): implement a simple caching mechanism with TTL and prefix invalidation
refactor(expenses): integrate caching for periodic expenses and related operations refactor(quotes): add caching for quotes retrieval and history endpoints
This commit is contained in:
@@ -7,6 +7,8 @@ import { startQuoteJob } from "./modules/quotes/quote.job";
|
||||
import quotesRouter from "./modules/quotes/quotes.routes";
|
||||
import expensesRouter from "./modules/expenses/expenses.routes";
|
||||
import { startExpenseJob } from "./modules/expenses/expense.job";
|
||||
import { cache } from "./lib/cache";
|
||||
import { eventBus } from "./lib/event-bus";
|
||||
import { logger } from "./lib/logger";
|
||||
|
||||
const app = new Hono();
|
||||
@@ -32,6 +34,10 @@ app.route("/api", expensesRouter);
|
||||
app.use("/assets/*", serveStatic({ root: "./web" }));
|
||||
app.get("*", serveStatic({ path: "./web/index.html" }));
|
||||
|
||||
eventBus.on("quotes-updated", () => {
|
||||
cache.invalidateByPrefix("quotes:");
|
||||
});
|
||||
|
||||
startQuoteJob();
|
||||
startExpenseJob();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user