natur-persist-async introduction asynchronous persistent cache middleware for natur state manager synchronization operation has a certain delay, use anti-shake for synchronization operation demo parameter createPersistMiddleware options name require: false
type: string
default: '_data'
when adding elements to localStorage, this name will be added as a prefix when setting the name of the key to prevent naming conflicts between different applications time require: false
type: number
default: 100
synchronization delay. When synchronizing data to localStorage, use debounce as a synchronization mechanism, and there is a certain delay. exclude require: false
type: Array<string|RegExp>
when synchronizing module data to localStorage, you can configure whether to ignore caching certain modules include require: false
type: Array<string|RegExp>
when synchronizing module data to localStorage, you can configure whether to cache only certain modules, exclude priority is higher than include specific require: false
type: {[moduleName: string]: number}
configure the delay time of some modules, if the number is 0, then it will be a synchronous buffer without anti-shake mechanism setItem require: true
type: (key: string, value: any) => Promise<any>
implementation of saving data to cache getItem require: true
type: (key: string) => Promise<any>
get cached data implementation removeItem require: true
type: (key: string) => Promise<any>
delete cache data implementation createPersistMiddleware return value middleware middleware, used to intercept store data and trigger the caching mechanism getData get the data in the cache clearData Last Updated: 1/24/2021, 5:17:51 PM