Skip to content

Fixed clear() function not working + added test - #4

Closed
wole-kolawole wants to merge 1 commit into
masterfrom
fix/clear-not-working
Closed

Fixed clear() function not working + added test#4
wole-kolawole wants to merge 1 commit into
masterfrom
fix/clear-not-working

Conversation

@wole-kolawole

Copy link
Copy Markdown

This pull request improves the reliability of the cache clearing mechanism and adds a dedicated test to ensure correct behavior when the cache file is modified by another process during a pending clear operation. The main theme is to prevent stale or unexpected data from being reloaded after a clear, even if the file is changed externally before the clear operation is flushed.

Bug Fixes & Reliability Improvements:

  • Modified the load() function in index.js to check for a pending clear operation (_clearPending) before reloading data from disk, preventing the in-memory store from being repopulated with stale or external data during a clear.

Testing Enhancements:

  • Added a comprehensive test in tests/clear.spec.js to simulate an external file change during a pending clear, verifying that all keys remain cleared and no external data is loaded after a clear operation.

Co-authored-by: Copilot <copilot@github.com>
@john-doherty

Copy link
Copy Markdown
Contributor

closing... out of date

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.

2 participants