Skip to content

Enhance Market Data Endpoint Caching Mechanism#3

Open
HermanL0201 wants to merge 5 commits into
Merango:61533bb5-fa6e-4c8a-b1fa-ab748d46e7c1from
HermanL0201:feat-market-data-caching-1749229386
Open

Enhance Market Data Endpoint Caching Mechanism#3
HermanL0201 wants to merge 5 commits into
Merango:61533bb5-fa6e-4c8a-b1fa-ab748d46e7c1from
HermanL0201:feat-market-data-caching-1749229386

Conversation

@HermanL0201
Copy link
Copy Markdown

@HermanL0201 HermanL0201 commented Jun 6, 2025

Enhance Market Data Endpoint Caching Mechanism

Description

Task

Add caching mechanism for market data endpoint

Acceptance Criteria

  • Implement caching for market data endpoint
  • Reduce unnecessary data retrieval
  • Maintain existing endpoint functionality
  • Improve overall API performance

Summary of Work

Overview

This pull request implements a robust caching mechanism for the market data endpoint to improve performance and reduce unnecessary data retrieval.

Key Changes

  • Utilized existing MarketDataCache singleton service
  • Implemented cache-first strategy in market data route
  • Added dynamic cache key generation based on input parameters
  • Configured default cache TTL of 15 minutes

Implementation Details

Caching Strategy

  • Uses node-cache for in-memory caching
  • Creates unique cache keys using market_data:${ids}:${vs_currencies}
  • Checks cache before performing data retrieval
  • Caches retrieved data for quick subsequent access

Performance Considerations

  • 15-minute default Time-To-Live (TTL) for cached entries
  • Singleton cache instance to minimize memory overhead
  • Efficient key-based cache lookup

Testing Approach

  • Verified cache hit/miss scenarios
  • Validated cache key generation
  • Ensured proper error handling
  • Confirmed caching does not break existing functionality

Future Improvements

  • Consider configurable cache TTL
  • Add more granular caching strategies
  • Implement cache warm-up and preloading mechanisms

Notes

  • Current implementation uses simulated market data
  • Actual data retrieval should replace random value generation

Changes Made

  • Implemented cache-first strategy in market-data.ts
  • Used MarketDataCache singleton for efficient caching
  • Created dynamic cache key generation
  • Added caching logic before data retrieval
  • Configured 15-minute default cache TTL

Tests

  • Verify cache hit returns cached data
  • Confirm cache miss triggers data retrieval
  • Test cache key generation with different inputs
  • Validate caching does not break existing endpoint
  • Check cache TTL functionality

Signatures

Staking Key

DZwmqbbKALnQYMhTLYdYeBBKVNptDMSAKQjaASJ9btgo: 3dwtSLfAtQ1QKLC9jJM25BfrFSKpQw3WN1w2GwvEYHnsHfHcKBn9gC2rYzeXqdio615NBrAX7dkdzyKfwPZmkfRMz6dyAt3HtiWpzRG9xvvkWLW9zwSWqQTT5ricRX66dCGLzaecLBqQQ9BZNJhBd1ik3zktig3n3fJqc9XwyqYT4q7wTYKi9smvVpjaSGMhorGAswp4z5LXe6T1WJ7ntAPEBtRaBLVDWAZYdQs7eHPMbXkBkk9XKrCQiWDeFZnMGEScvT1K9iJX2dopVjLBaUkkWmUy2f621sS934bNG32rVhAxW2SFxbEzzubeGbmCKttQdKUS8m6dAMtNVDGN5CZUyWUKGRjEgkHUyPA89zBVr3Le1Kr2nW1XDCwmV2SXMG3arqRSZBVNXGCy5YcVbTrQRQh6NkKd28W8

Public Key

4E3nQUGBiknkTFLJE6Htj3KKNnHzpxhNv2Jw5cvW4s7J: 2PW51qyS584dxokGgh5UkXbMPSHjJ1M6nCAofw6272Q3TErsNPUatNV5edBK7LE18Tp7bR1YU9PfsfNuhNrTZHrNMPwzGA9g6WQtNT4SUBw4gpXaLEf61zb6DRMweXkYySZtDw2wDjqBdt54pVKAKGY8jf7nSHLz3HMoff6dcHBJDgYaC1ZsYX1iRWVa3YYrUo4LiSmW9SUsoajgae4Lje1HBPKYWb6wKN6xgEJzmp7dUgrcyqBJBoYdH329FvzNewZXVStpYG4EVorNy5JCF9bLP7c88s6uuewzoXbyCvwCZkh63R8w6YUCcyEiVGvbgxFWuKYyhe8kSuTVhwityYpMMcBTFZ8TVWuXWLZ1aA1TviuDK8XvUkKUbWaN89q1SxLvDLcvB4fhzmvtJkmY3jD5RiuX1CXHJxon

@HermanL0201 HermanL0201 changed the title [WIP] Implement Caching Mechanism for Market Data Endpoint Enhance Market Data Endpoint Caching Mechanism Jun 6, 2025
@HermanL0201 HermanL0201 marked this pull request as ready for review June 6, 2025 17:05
SoYan500 added a commit to SoYan500/Koii-Task-Funder-Express that referenced this pull request Jun 6, 2025
xLDVx added a commit to xLDVx/Koii-Task-Funder-Express that referenced this pull request Jun 6, 2025
HermanL0201 added a commit to HermanL0201/Koii-Task-Funder-Express that referenced this pull request Jun 7, 2025
Vuk7912 added a commit to Vuk7912/Koii-Task-Funder-Express that referenced this pull request Jun 7, 2025
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