Separate plugin data.json into "settings" and "cache" files

Use case or problem

Several plugins use their settings data to cache things to disk. For example, “Novel Word Count” has a section for cached data, and “Enhanced Annotations” keeps track of inactivity. This use of the data.json creates a ton of unneeded changes in the files for those of us who use git to version our vaults. Usually, I would add the cache data to a .gitignore file, as I have done for the workspace.json file. But this data is being stored in the same file as the settings data for the plugins, which is something I want to commit to my repo.

Proposed solution

In the same way obsidian provides the save and load data functions to plugins, it should provide an API for a dedicated disk cache. This could be adding a “cache.json” to the plugin folders, or a singular json file that each plugin gets a key inside. This way, the data that is constantly changing on disk can be .gitignore’d.

Current workaround (optional)

Thus far, I’ve worked around this for “Enhanced Annotations” by going into the code and commenting out anything that deals with plugin inactivity, so it isn’t constantly modifying data.json. I shouldn’t have to do this. And now “Novel Word Count” has a similar problem, but the whole purpose behind that plugin is that it caches its data, so this isn’t something I can just change.

Related feature requests (optional)

TBD

what data.json are you talking about?

It sounds like they mean the one in plugin folders that they save data to.

Ok, thank you. data.json is for data that plugin developer want to save on disk so it gets synced by Obsidian Sync (and other solution). There are other ways (and other APIs that the plugins can use) to save data locally that won’t get synced.

This is something that each plugin developer choses based on their needs/desires. You’ll need to open a FR/discussion in the “Novel Word Count” repo

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.