angularjs - how does Angular $http cache key get created -


it not specific in angular docs how $http checks cache existing keys.

for example, when do:

$http.get("/search/11", { cache: true }); 

the cache work.

but if

$http.get("/search", { cache: true, params: { age: 11 } }); 

or more complicated

$http.post("/search", objectparams, { cache: true }); 

will pass cache if change 1 of properties of objectparams?

the more general question is, how angular know when serve cache vs make new request? compare url, params, postload, or of them?

the cache key url built buildurl function in http.js(src):

url = buildurl(config.url, config.params); 

which creates url query string part : ?key1=val1&key2=val2 out of config.params.

so,

$http.get("/search", {cache: true, params: {key1: "val1"}}) // or $http.post("/search", postdata, {cache: true, params: {key1: "val1"}}) 

will have cache key of "/search?key1=val1"


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -