Skip to content

FOUR-31921 Implement Request Cache and Request Deduplication Layer for ProcessMaker.apiClient#8877

Open
devmiguelangel wants to merge 5 commits into
feature/FOUR-30918from
FOUR-31921
Open

FOUR-31921 Implement Request Cache and Request Deduplication Layer for ProcessMaker.apiClient#8877
devmiguelangel wants to merge 5 commits into
feature/FOUR-30918from
FOUR-31921

Conversation

@devmiguelangel

@devmiguelangel devmiguelangel commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Issue & Reproduction Steps

Implement Request Cache and Request Deduplication Layer for ProcessMaker.apiClient

Solution

Implemented a lightweight cache and request-deduplication layer for ProcessMaker.apiClient.

The cache supports opt-in GET response caching with a default 5-second TTL, per-request TTL overrides, global enable/disable controls, cache invalidation by URL or pattern, lazy expiration cleanup, and optional debug logging.

Concurrent identical GET requests now share one in-flight Promise and produce a single network request. Completed responses are cached only after successful requests; non-GET and failed requests bypass caching.

Expanded unit coverage for TTL expiry, custom TTLs, failures, non-GET behavior, global cache controls, per-request opt-out, key isolation by request configuration, invalidation, debug logs, and concurrent request deduplication.

Validation
npx jest --runInBand --testMatch '**/tests/js/apiClientCache.test.js'

Screenshot 2026-06-19 at 3 17 38 PM

Related Tickets & Packages

FOUR-31921

Code Review Checklist

  • I have pulled this code locally and tested it on my instance, along with any associated packages.
  • This code adheres to ProcessMaker Coding Guidelines.
  • This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
  • This solution fixes the bug reported in the original ticket.
  • This solution does not alter the expected output of a component in a way that would break existing Processes.
  • This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
  • This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
  • This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
  • This ticket conforms to the PRD associated with this part of ProcessMaker.

@devmiguelangel devmiguelangel self-assigned this Jun 19, 2026
@devmiguelangel devmiguelangel requested a review from caleeli June 19, 2026 19:43
@processmaker-sonarqube

Copy link
Copy Markdown

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube

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