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

Override stringify and destr validation checks #474

Open
1 task done
Xenossolitarius opened this issue Sep 1, 2024 · 1 comment
Open
1 task done

Override stringify and destr validation checks #474

Xenossolitarius opened this issue Sep 1, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Xenossolitarius
Copy link

Describe the feature

I have 2 issues which are basically the same:

  1. I've got a problem all the way up in Nuxt where i wanted to use defineCachedFunction where I wanted to use cache with raw memory, and while working with large payloads I've hit the issue with unstorage implementation of validation leading in the end to parsing and stringification with JSON.parse/stringify. There are getItemRaw and setItemRaw implementations which i've used and reimplemented the above mentioned cache handler but I would like to generally write a "rawMemory" driver that I can just plug in and override the JSON validation layers.

  2. Because of working with large payloads I have a need for speed (pun) and raw JSON.stringify doesn't do the job. There are other tools like precomiplation json stringifiers like fast-json etc. I am unable to leverage those libraries and need to write unstorage implementation from scratch.

I would offer a very simple PR adding some options to the drivers but unfortunately I don't think i'll get it right typescript wise.

I love the whole stack and appreciate the hard work.
Thank you

Additional information

  • Would you be willing to help implement this feature?
@Xenossolitarius Xenossolitarius added the enhancement New feature or request label Sep 1, 2024
@bitbytebit1
Copy link

I'm also in the same position where I'm getting a "[nitro] [cache] Cache write error. RangeError: Invalid string length" due to trying to save very large data in the defineCachedFunction

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

No branches or pull requests

2 participants