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

Use .data/cache for cache storage by default #2222

Open
pi0 opened this issue Mar 6, 2024 · 2 comments
Open

Use .data/cache for cache storage by default #2222

pi0 opened this issue Mar 6, 2024 · 2 comments
Labels
discussion enhancement New feature or request

Comments

@pi0
Copy link
Member

pi0 commented Mar 6, 2024

Currently we use {buildDir}/cache for cache storage by default but the downside is that, downstream frameworks (Nuxt) might choose to remove it entirely on each build causing to loose the cache.

As part of this directory migration, we might use a SQLite database now that we have useDatabase() to reduce FS IO overhead. (to be benchmarked also depends on unjs/unstorage#400)

@Atinux
Copy link
Member

Atinux commented Mar 6, 2024

I think that moving the cache directory to .data/cache is a good idea for consistency between Nitro & other FE frameworks.

Regarding SQLite database, I am not 100% sure as it can be quite slow in edge environment (ex: D1) as they don't have replication yet. To be benchmarked indeed. There could also be a way of usingunstorage + SQLite driver.

Do you plan to use another database for the cache as well and make it configurable somehow?

@pi0
Copy link
Member Author

pi0 commented Mar 6, 2024

I am not 100% sure as it can be quite slow in edge environment (ex: D1)

Per preset, we can decide and it is (and remains) in "memory" by default.

I am suggesting different cache storage for Dev and Server deployment with SQLite support (Node.js, Bun). It needs to be benchmarked but in theory, reducing IO and batching it should gain perf.

Do you plan to use another database for the cache as well and make it configurable somehow?

Same as today, cache storage can be configured using unstorage cache: mount. See this relevant tracker: unjs/unstorage#400

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants