Skip to content

refactor(cache): split a getCached function out#360

Merged
ezolenko merged 1 commit into
ezolenko:masterfrom
agilgur5:refactor-cache-split-getCached
Jun 24, 2022
Merged

refactor(cache): split a getCached function out#360
ezolenko merged 1 commit into
ezolenko:masterfrom
agilgur5:refactor-cache-split-getCached

Conversation

@agilgur5

@agilgur5 agilgur5 commented Jun 17, 2022

Copy link
Copy Markdown
Collaborator

Summary

Decent size simplification in tscache so that getDiagnostics and getCompiled call a common getCached function, which is just a tiny refactor of the code that getDiagnostics already had.

Details

  • basically, refactor the getDiagnostics a tiny bit to also handle what the getCompiled function needs

    • then just call getCached from both instead
    • getDiagnostics and getCompiled were near identical except for the cache they used and checkImports, which are both parameters now
      • getCompiled also had a logging statement (called in both noCache and w/ cache branches), which was moved to before the call to getCompiled instead
      • the type param was composed into another function in getDiagnostics before the call too getCached now
    • this simplifies all the cache code to one main function now
  • remove the markAsDirty call under noCache, as well, "dirty" has no meaning for noCache anyway

    • this simplifies that one if statement now too

References

- basically, refactor the `getDiagnostics` a tiny bit to also handle what the `getCompiled` function needs
  - then just call `getCached` from both instead
  - `getDiagnostics` and `getCompiled` were near identical except for the cache they used and `checkImports`, which are both parameters now
    - `getCompiled` also had a logging statement (called in both `noCache` and w/ cache branches), which was moved to before the call to `getCompiled` instead
    - the `type` param was composed into another function in `getDiagnostics` before the call too `getCached` now
  - this simplifies all the cache code to one main function now

- remove the `markAsDirty` call under `noCache`, as well, "dirty" has no meaning for `noCache` anyway
  - this simplifies that one `if` statement now too
@agilgur5 agilgur5 added kind: internal Changes only affect the internals, and _not_ the public API or external-facing docs scope: cache Related to the cache labels Jun 17, 2022
@ezolenko ezolenko merged commit 229dea5 into ezolenko:master Jun 24, 2022
@agilgur5 agilgur5 deleted the refactor-cache-split-getCached branch July 2, 2023 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind: internal Changes only affect the internals, and _not_ the public API or external-facing docs scope: cache Related to the cache

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants