Closed bigboydiamonds closed 2 months ago
The changes introduce a new caching mechanism to the bridgeLimitsController
within the packages/rest-api
module. A dependency on node-cache
has been added, allowing the controller to store and retrieve responses based on query parameters. This optimization reduces processing time for repeated requests by checking for cached responses before executing further logic, ultimately enhancing the efficiency of the API.
File | Change Summary |
---|---|
packages/rest-api/package.json | Added new dependency node-cache version ^5.1.2 . |
packages/rest-api/src/controllers/bridgeLimitsController.ts | Implemented caching functionality using NodeCache , checking for cached responses before processing requests. |
sequenceDiagram
participant Client
participant Controller
participant Cache
participant TokenService
Client->>Controller: Request bridge limits
Controller->>Cache: Check for cached response
alt Cache hit
Cache-->>Controller: Return cached response
Controller-->>Client: Send response
else Cache miss
Controller->>TokenService: Retrieve token information
TokenService-->>Controller: Return token data
Controller->>Cache: Cache the response
Controller-->>Client: Send response
end
In the garden of code, a rabbit hops free,
Caching the limits, as swift as can be.
Withnode-cache
added, oh what a delight,
Reducing the waits, making queries so bright!
Hooray for the changes, let’s dance and rejoice,
For faster responses, we all have a voice! 🐇✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 37.95792%. Comparing base (
9418b40
) to head (32d0b4b
). Report is 29 commits behind head on master.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Latest commit: |
32d0b4b
|
Status: | ✅ Deploy successful! |
Preview URL: | https://9453c99d.sanguine-fe.pages.dev |
Branch Preview URL: | https://api-cache-bridge-limits.sanguine-fe.pages.dev |
Description Caching responses based on query params for
/bridgeLimits
endpoint.Using
node-fetch
package to cache responses for 1hr.Summary by CodeRabbit
New Features
Bug Fixes