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

Caching SuperCluster Index #218

Open
melbinexperion opened this issue Mar 21, 2023 · 4 comments
Open

Caching SuperCluster Index #218

melbinexperion opened this issue Mar 21, 2023 · 4 comments

Comments

@melbinexperion
Copy link

Hi, is it possible to cache index generated by SuperCluster so that I can use it next time instead of calling new Supercluster({}).load() Again?

The code below takes time for large records. I am trying to get over this issue.

superclusterIndex = new Supercluster({
map: (props) => props,
radius: MapConfig.clusterRadius,
maxZoom: ClusterZoomLevel.maxZoom,
}).load(geoJsonData.features);

@Enkosz
Copy link

Enkosz commented Mar 28, 2023

What do you mean by caching? You could simply save it into a singleton variable or whatever and use it as you need it.

@melbinexperion
Copy link
Author

@Enkosz More like I wanted it to persist even after killing the app. So that I don't have to generate superClusterIndex again. The data I am handling is big like close to 70000 records. I was checking if I can save it in some storage so that each time user opens the app after killing, the indices generated are available.

@meta-meta
Copy link

I'm wondering the same. My use case: running on servers behind a load balancer, with multiple sessions each clustering their own set of data. Each session is for a group of users that want to see the same clusters but may be hitting different servers. So I'm wondering if it's feasible to serialize the index and persist to a DB.

@LeoMiguelB
Copy link

@meta-meta @melbinexperion #134 explains how to serialize index

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

5 participants