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

Feature request - Caching #45

Open
rogerkerse opened this issue Oct 7, 2022 · 4 comments
Open

Feature request - Caching #45

rogerkerse opened this issue Oct 7, 2022 · 4 comments

Comments

@rogerkerse
Copy link

When you put multiple link preview components to the screen with same link, then it makes multiple fetches to the link. In our use case we could have thousands of previews with same link

@demchenkoalex
Copy link
Member

Hmm where I would store the cache given the component can be placed anywhere, including lists? The cache makes sense on the app level, but on the library level, not sure.. I will need async storage or something, but this is a native dependency, plus some people use alternative like mmkv. Do you have ideas how this can be implemented?

@JonathanColetti
Copy link

@demchenkoalex I know this is late and to be honest a cache can be more trouble then good but what about a InMemoryCache like apollo graphql

@demchenkoalex
Copy link
Member

will not work on this in the foreseeable future :/

@TimHero
Copy link

TimHero commented Apr 8, 2024

just an idea on implementing this without native dependencies and giving user flexibility: https://docs.pmnd.rs/zustand/integrations/persisting-store-data
zustand essentially allows you to pass in an object that defines the get set and remove cach functions and it handles them accordingly on startup and during use.
To make it simpler for this library you could just have an optional prop instead of a wrapper cacheHandler={{getItem:AsyncStorage.getItem, setItem:AsyncStorage.setItem, removeItem:AsyncStorage.removeItem, key: 'nameOfCache'}} with getItem(key+otherconfig) called on mount. and setItem(key+otherconfig) called onPreviewDataFetched.

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

No branches or pull requests

4 participants