Skip to content

feat: Add flushCache() export to WTM#123

Closed
pankti-shah-1kosmos wants to merge 2 commits into
mainfrom
feature/flush-cache
Closed

feat: Add flushCache() export to WTM#123
pankti-shah-1kosmos wants to merge 2 commits into
mainfrom
feature/flush-cache

Conversation

@pankti-shah-1kosmos

Copy link
Copy Markdown
Contributor

Summary

Exposes a flushCache() method from WTM.js to allow services to programmatically clear the internal HTTP response cache (NodeCache).

Change

const flushCache = () => {
    const keys = cache.keys();
    cache.flushAll();
    return keys.length;
};

Added to module.exports alongside existing executeRequest and createRequestID.

Why

WTM caches all HTTP responses (service discovery, CaaS configs, public keys) with up to 10-minute TTL. As part of the distributed cache flush feature (PL30-413), services need to clear stale WTM cached responses on demand when a cache reset signal is received via Kafka.

Impact

  • 3 lines added, 1 line changed (exports)
  • No changes to existing executeRequest or createRequestID behavior
  • New export only — zero impact on any service until explicitly called
  • Services already have a typeof WTM.flushCache === 'function' guard that will pick this up automatically

Related

@pankti-shah-1kosmos

Copy link
Copy Markdown
Contributor Author

Closing in favor of PR #124 targeting develop

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