Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jun 24, 2022

Conversation

agilgur5
Copy link
Collaborator

@agilgur5 agilgur5 commented Jun 17, 2022

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