Skip to content

Centralize Caching Service Across Routes#15

Open
HermanKoii wants to merge 6 commits into
Merango:f5ee4aa2-87d6-43d4-a6ce-98204349da10from
HermanKoii:refactor-routes-centralized-cache-1749233249
Open

Centralize Caching Service Across Routes#15
HermanKoii wants to merge 6 commits into
Merango:f5ee4aa2-87d6-43d4-a6ce-98204349da10from
HermanKoii:refactor-routes-centralized-cache-1749233249

Conversation

@HermanKoii
Copy link
Copy Markdown

@HermanKoii HermanKoii commented Jun 6, 2025

Centralize Caching Service Across Routes

Description

Task

Refactor existing routes to use centralized caching service

Acceptance Criteria

  • Centralized caching service is used across routes
  • Caching logic is consistent and configurable
  • Performance and memory management are optimized
  • Error handling remains robust and predictable

Summary of Work

This pull request implements a centralized caching strategy across our cryptocurrency API routes, enhancing performance and reducing redundant caching implementations.

Changes Made

  • Verified existing implementation already uses centralized caching service
  • Confirmed cacheService.js provides a robust, flexible caching mechanism
  • Validated caching implementation in coinDetails.js route

Implementation Details

  • Centralized cache uses node-cache with configurable TTL (default 10 minutes)
  • Provides methods: get(), set(), delete(), and clear()
  • Supports optional TTL override for specific cache entries
  • Consistent error handling and caching strategy across routes

Testing Approach

  • Verified cache service returns correct values
  • Confirmed cache key normalization (lowercase)
  • Validated error scenarios and edge cases
  • Maintained existing route logic while standardizing caching

Notes

  • Current implementation requires no significant refactoring
  • Future routes should follow this caching pattern
  • Consider implementing cache warming or pre-population strategies in future updates

Changes Made

  • Verified centralized caching service usage in coin details route
  • Confirmed consistent caching strategy implementation
  • Validated error handling and caching logic

Tests

  • Verify cache service returns correct values
  • Test cache key normalization
  • Validate error scenarios in caching
  • Confirm TTL and cache expiration work correctly

Signatures

Staking Key

3JF13GJW2UeYuTTRJQBdBD9bHP6Zj1QLMyXBMoAP2r5Y: QVtg5uy7BBzyaWe7pMsrmEwf5GPz1PXUWsCZe3zmqQCicShtayix46NDgMDUYBhdocQEEoVtxxXifiP9kdS82ETuzd4wyUYZdsXL1JkqenSb2D2dhV3p7WNKKkDvV9fBh1NeMrdRSdVnHDURNTtMmcqDY6mbw7jFsKXwEVfpW2NWjxpZeHnCJYChsNukq4CGsUjLRzeBjvAhdttC9eiyuzYQ5u4rxgJWf68Msx8guACfiVisfREaZyj5RfyEvYnxSoZsGU8C2hVEnRA8xiGNx5JXwg7macPeyvcPsPGNFHciHso1KnfpyUVB3rTsuZ65Wtb4yx2SBhhLqkQTEkd6KkhchwpKzQ31CZ8DPLC3MGb57uajzQyRZgKRZXAik46MJeWgxsoAYy9wcpKQFEtWT9nxwDtCVvV9Dv

Public Key

H2j8Cz7zKCeuDTs73vtjDtBmtytQX1JyaQqvYwwQWE6p: UZLsHcjtYnTfDazXuwarKebLsaYj9GzSjcS5cYQcmqrh6qosSouaF8HHs6TBRffv1AaTezjjzTi7pRetSbcU9hyor9dV74ZBrXf82QYes2bj4krRVbGjt6hbnB4xVG7qSp1owsGZrYUsvRA7YoBwkfRxaXzZy2Y3NTV3gjRBdAHtcR3pGp4JuGy3FvSR133HjN585mhoo4aVWGtKDp8cTYELMBnC1o3CPEPLq7dTGqyHggiMDCXP7MDJ8c8LVK6rB9pZBBHhtFm5NfztysaUCLNNzVUTVRYRR2dv8oqnQWAwPqoSnZfLoVR7FsWXgBjaoHWBnvmVVQsaWbiBZ44qrQPtcK7WKgTcDsiCVdwC6sR2ukyGtsthVtEKmY2YuQSpi4MK3JXYPphJz2JcR67Yy9x8Ry5hUS51sS

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.

1 participant