Skip to content

fix: implement clear_cache function for FFFClearCache command#336

Closed
JasonOA888 wants to merge 2 commits intodmtrKovalenko:mainfrom
JasonOA888:fix/add-clear-cache
Closed

fix: implement clear_cache function for FFFClearCache command#336
JasonOA888 wants to merge 2 commits intodmtrKovalenko:mainfrom
JasonOA888:fix/add-clear-cache

Conversation

@JasonOA888
Copy link
Copy Markdown

Summary

The :FFFClearCache user command calls require("fff").clear_cache(), but this function did not exist, causing an error when running the command.

Changes

  • Add clear_cache(scope) function to lua/fff/main.lua
  • Supports three modes:
    • "all" (default) - clears both frecency and history caches
    • "frecency" - clears only frecency database
    • "files" - clears only query history database

Testing

:FFFClearCache        " clears all caches
:FFFClearCache all    " same as above
:FFFClearCache frecency
:FFFClearCache files

Closes #169

The :FFFClearCache user command was calling a non-existent clear_cache()
function. This adds the missing implementation that clears frecency and
history caches based on the scope argument.

Closes dmtrKovalenko#169
@dmtrKovalenko
Copy link
Copy Markdown
Owner

Have you actually tested it? lmdb is mapping the files and this can crush neovim and likely wouldn’t work on windows (which is fine tbh)

Use fuzzy.destroy_db() and fuzzy.destroy_query_db() to properly
close memory-mapped LMDB files before deleting. Directly deleting
the directory while files are mapped can crash Neovim.

Addressed maintainer feedback on dmtrKovalenko#336
@dmtrKovalenko
Copy link
Copy Markdown
Owner

closed by ea1f980

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.

FFFClearCache user command: function clear_cache does not exist

2 participants