rt2zz / redux-persist

persist and rehydrate a redux store
MIT License
12.91k stars 863 forks source link

Is there any way to split serialization via localforage? #1362

Open rvision opened 2 years ago

rvision commented 2 years ago

I am using localforage with IndexedDB and this works out of the box:

localforage.config({
    driver: [localforage.INDEXEDDB, localforage.LOCALSTORAGE],
    name: 'database'
});

however, my state will hold a lot of time series data in following shape:

slots: {
    '2021-01-01': {
        njTGdi: {
            start: 540,
            duration: 60,
            userId: 'gfnw8',
            notes: '',
        },
        cegw23: {
            start: 540,
            duration: 60,
            userId: 'gfnw8',
            notes: '',
        },
    },
    '2021-01-02': {
        Ujghti: {
            start: 540,
            duration: 60,
            userId: 'gfnw8',
            notes: '',
        },
        oiYHbg: {
            start: 540,
            duration: 60,
            userId: 'gfnw8',
            notes: '',
        },
    },
},

so this list will grow over time and I am afraid serialization won't be fast as needed.

Is there any way to segment this data? like, for example, to save each of the days as separate key/value pair? how to do that?

thanks