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

[Bug] I've encountered some problems regarding caching and hope to get your guidance. #1867

Open
tydot0730 opened this issue Feb 28, 2025 · 0 comments

Comments

@tydot0730
Copy link

Describe the Bug

First of all, I'm very sorry for disturbing you during your rest time. However, I still hope to get your help when you're available.The images used in the project I'm currently developing are mostly quite large, As shown in the figure, the image may have hundreds of layers.so the loading speed is very slow. Therefore, I'm trying to use IndexDB to accelerate the loading speed when opening the images for the second time. Or, I'm also looking into other ways to speed up the loading process.

Image

Steps to Reproduce

As shown in the figure, here is the source code where I attempted to use IndexedDB. In the loadImageFromCacheOrVolume method of imageloader.ts, I inserted the IndexedDB methods I wrote. The idea is that if data is retrieved from IndexedDB, then return this imageData. Otherwise, after the original loadImageFromImageLoader method is executed, store the imageData from the iterator into IndexedDB.

Image

The current behavior

After completing this step, I went back to the BaseStreamingImageVolume.ts file. In the callLoadImage method, I defined a custom successCallbackDB method similar to successCallback, as well as _scaleIfNecessaryDB, to prevent the issue of not being able to retrieve the cached image when getting data from IndexedDB. However, it seems that it didn't work, and the images cannot be loaded. As shown in the figure is the code I wrote. I really hope you can give me some constructive suggestions.

Image

Image

Image

Image

The expected behavior

This is the result of using the above method - the images cannot be loaded. I hope you can give me some constructive suggestions.

Image

OS

Windows10

Node version

18.20.0

Browser

Google Chrome 133.0.6943.127

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant