Skip to content

feat: implement Redis-based caching layer for service discovery (#316)#355

Closed
Abhushan187 wants to merge 3 commits into
souma9830:masterfrom
Abhushan187:feat/redis-caching-service-discovery
Closed

feat: implement Redis-based caching layer for service discovery (#316)#355
Abhushan187 wants to merge 3 commits into
souma9830:masterfrom
Abhushan187:feat/redis-caching-service-discovery

Conversation

@Abhushan187

Copy link
Copy Markdown
Contributor

Closes #316

Changes by file

File Change
server/package.json Added ioredis ^5.6.1 dependency.
server/config/redis.js New. Redis connection, getOrSetCache helper (cache-aside with TTL), deleteCachePattern for wildcard invalidation, graceful disconnect.
server/controllers/issueController.js Wrapped getNearbyIssues with getOrSetCache (5-min TTL). Added cache invalidation in createIssue and updateIssueStatus for the affected category.
server/server.js Imported disconnectRedis; added SIGTERM/SIGINT graceful shutdown handler.
.env.example / server/.env.example Added REDIS_URL documentation.

Technical Notes

  • ioredis chosen over node-redis for built-in cluster support, pipelining, and robust reconnection.
  • Cache key format: nearby:{lat}:{lng}:{category}:{radius}:{zoom} — lat/lng rounded to 4 decimals (~11m precision) to balance granularity vs cache hit rate.
  • getOrSetCache falls back to DB query on any Redis error — no cache outage takes down the API.
  • deleteCachePattern uses scanStream + pipeline to avoid KEYS blocking on large datasets.
  • TTL is 300 seconds (5 minutes) as requested. Cache invalidation is fire-and-forget (.catch on promise) to avoid blocking the response.
  • Graceful shutdown ensures Redis connection is closed before process exit, preventing connection leaks in containerized environments.

@vercel

vercel Bot commented Jun 6, 2026

Copy link
Copy Markdown

@Abhushan187 is attempting to deploy a commit to the souma9830's projects Team on Vercel.

A member of the Team first needs to authorize it.

@souma9830

Copy link
Copy Markdown
Owner

Resolve conflict and tell me under which open source program
you are ?

@Abhushan187

Copy link
Copy Markdown
Contributor Author

Resolve conflict and tell me under which open source program you are ?

merge conflict resolved and im nsoc'26 contributor ,is this project part of gssoc'26 as well btw ?

@Abhushan187 Abhushan187 changed the title eat: implement Redis-based caching layer for service discovery (#316) feat: implement Redis-based caching layer for service discovery (#316) Jun 8, 2026
@souma9830

Copy link
Copy Markdown
Owner

still have merge conflict

@Abhushan187

Copy link
Copy Markdown
Contributor Author

still have merge conflict

checkout now and please merge it before 15th june for nsoc evaluation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] Implement Redis-based Caching Layer for Service Discovery

2 participants