javascript - Caching array requests - Lazy Loading -


i have bunch of json files need send through wire. each file quite big, , need load them on demand.

my server serves files dynamically, , allows array gets (to minimize http requests).

so means if need json file [1, 2, 3, 4, 16, 17, 32], makes ajax request server array , json.

now understanding caching done per request. means if application needs json file 1 again, make new request instead of cached version since it's different request first.

how solve problem?

why don't create central 'module' deal sending requests back-end. there can store registry (or simple array) store files that had been fetched; way can decide whether make request or not.

from understood, array send back-end contains identifiers of json files server can locate. if case, store id's in central module e.g. dataservice , make checks before make further requests

if jsontofetch in jsoncache      return else     make request    add jsontofetch jsoncache 

Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -