hermes - 💡(How to fix) Fix perf(server): implement caching for cinema schedules [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#12536Fetched 2026-04-20 12:18:34
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants
RAW_BUFFERClick to expand / collapse

Problem

The endpoint /api/cinemas/:id (and potentially /api/cinemas) fetches showtimes and cinema data directly from the database on every request. Since cinema schedules typically change only once a day or every few hours, this creates unnecessary database load and increases response latency for users.

File(s)

server/src/routes/cinemas.ts server/src/services/cinema-service.ts

Suggested Fix

Implement a caching layer using Redis (which is already available in the project) to store the result of getCinemaShowtimes for a short period (e.g., 15-60 minutes). Use the cinema ID and week start date as the cache key.

Priority

MEDIUM

extent analysis

TL;DR

Implement a caching layer using Redis to store cinema showtimes for a short period to reduce database load and response latency.

Guidance

  • Review the getCinemaShowtimes function in cinema-service.ts to determine the best approach for integrating Redis caching.
  • Consider using a cache key that includes the cinema ID and week start date to ensure cache invalidation when schedules change.
  • Evaluate the optimal cache expiration time (e.g., 15-60 minutes) based on the frequency of cinema schedule updates.
  • Update the cinemas.ts route to utilize the cached showtimes instead of fetching from the database on every request.

Example

// Example cache implementation using Redis
import { RedisClient } from 'redis';
const redisClient = new RedisClient();

const cacheKey = `cinema-showtimes-${cinemaId}-${weekStartDate}`;
const cacheExpiration = 3600; // 1 hour

const getCinemaShowtimes = async (cinemaId: string, weekStartDate: string) => {
  const cachedShowtimes = await redisClient.get(cacheKey);
  if (cachedShowtimes) {
    return JSON.parse(cachedShowtimes);
  }

  const showtimes = await fetchShowtimesFromDatabase(cinemaId, weekStartDate);
  await redisClient.set(cacheKey, JSON.stringify(showtimes), 'EX', cacheExpiration);
  return showtimes;
};

Notes

The provided example is a basic illustration of caching with Redis and may require modifications to fit the specific project requirements.

Recommendation

Apply workaround: Implement a caching layer using Redis to reduce database load and response latency, as it is a targeted solution to the identified problem.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix perf(server): implement caching for cinema schedules [1 participants]