Skip to content

Fix #503: Improve caching#519

Open
kluhan wants to merge 9 commits into
codefori:mainfrom
Inventegrate:main
Open

Fix #503: Improve caching#519
kluhan wants to merge 9 commits into
codefori:mainfrom
Inventegrate:main

Conversation

@kluhan

@kluhan kluhan commented May 19, 2026

Copy link
Copy Markdown
Contributor

Summary

(Continuation of #504)

Fix duplicate include loading in RPGLE include graphs and harden cache behavior across parser/server flows.

This addresses the issue where the same include (for example d.rpgle) could be loaded multiple times when referenced through multiple branches (for example via b.rpgle and c.rpgle from a.rpgle).

Problem

See the bug report for details: Issue #503.

What Changed

  1. Include resolution dedup + short-lived include cache
  • Replaced boolean in-progress tracking with in-flight Promise dedup keyed by baseUri::includeString.
  • Added resolved-include cache with TTL and max-size eviction.
  • Added eviction of stale include cache entries when files change.
  1. Parser cache correctness and invalidation improvements
  • Added reverse dependency index (include -> dependents) to invalidate only affected files.
  • Switched parsed cache clearing from assigning undefined to deleting entries.
  • Added parsed/table/include cache hit/miss instrumentation (CacheMetrics).
  1. Remote file-content caching and tuning
  • Added TTL + max-entries cache for remote getFile content requests.
  • Added server-side cache settings hook from client initialization options.
  • Added user settings:
    • vscode-rpgle.cache.fileTTLSeconds
    • vscode-rpgle.cache.fileMaxEntries
  1. Concurrent table/lint config fetch dedup
  • Table cache fetch now shares in-flight Promise instead of returning transient empty values.
  • Lint config loading now deduplicates concurrent fetches and caches parsed JSON separately.
  1. Developer/diagnostic commands
  • Added RPGLE: Clear All Caches command.
  • Added RPGLE: View Cache Statistics command.

Why This Fixes the Reported Issue

For include graphs like:

a.rpgle
|- b.rpgle
|  \- d.rpgle
\- c.rpgle
   \- d.rpgle

the resolver now:

  • shares one in-flight include fetch for the same include key,
  • reuses recently resolved include results from cache,
  • avoids repeated full-cache scans during invalidation.

This prevents unnecessary repeated loads of shared include sources and reduces parse overhead for large graphs.

Checklist

  • have tested my change
  • updated relevant documentation
  • Remove any/all console.logs I added
  • eslint is not complaining
  • have added myself to the contributors' list in the README
  • for feature PRs: PR only includes one feature enhancement.

@kluhan kluhan mentioned this pull request May 19, 2026
6 tasks
@kluhan

kluhan commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

@worksofliam the PR should be ready for review now

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