angularjs - By enabling $http cache, what response time should be expected after initial requests? -


i've got {cache:true{ $http requests. know if enabled, data returned asynchronously, though, find response times surprisingly long.

i'd know if normal, or more clear, shouldn't expected initial request response time higher same (but next) request response time ?

for example,

cache enabled both $http requests:

/foo/api/yellow 

this returns data, after promise resolved, taking 3 seconds. expect cached angularjs, since i've enabled cache.

after few moments, new request made:

/foo/api/yellow 

this returns data, though supposedly cached in first request, response time same or higher 3 seconds. said, know though cache true, data returned asynchronously response times normal, or there wrong ?

if normal, guess best thing do, create new service, save cached data , check if data there , synchronously maybe ?

my current code looks this, first request:

$http.get(mysettings.apiurl + '/foo/api/yellow', { cache: true }); 

the second request same!

i've decided attach console log:

get http://foo/api/get_tag_index/  200 ok         419ms    angula....min.js (line 106) http://foo/api/get_category_posts/?slug=issues-covers  200 ok         915ms    angula....min.js (line 106) http://foo/api/get_category_posts/?slug=issues-covers  200 ok         1s   angula....min.js (line 106)  200 ok         4.43s    angula....min.js (line 106) http://foo/api/get_category_posts/?slug=cards  200 ok         8.93s    angula....min.js (line 106) http://foo/api/get_tag_posts/?slug=issue-01  200 ok         4.51s    angula....min.js (line 106) http://foo/api/get_category_posts/?slug=news  200 ok         4.51s    angula....min.js (line 106) http://foo/api/get_category_posts/?slug=cards  200 ok         3.86s    angula....min.js (line 106) 

thanks looking!

share|improve question
    
have checked backend not receive second request. guess receives it, , angular doesn't cache. what's code? happens when debug through angularjs's http sendreq function? – jb nizet oct 6 '13 @ 15:38
    
@jbnizet thought enabling cache, angularjs wouldn't send second request me. didn't checked that, because can see console that, it's sending request (you can see in log). should still debug using http sendreq - anyway, hope update more info soon. it-s strange... – punkbit oct 6 '13 @ 16:08
    
i don't have idea above logs come from, because didn't tell. why don't check if server receives requests? – jb nizet oct 6 '13 @ 16:10
    
@jbnizet i'm checking @ moment, hope update more info. way logs coming firebug console.log() – punkbit oct 6 '13 @ 16:20
    
what meant don't know add logging statements in code. if log call $http.get(), logged, if cache enabled. don't know how time logged measured, because didn't provide code. – jb nizet oct 6 '13 @ 16:24

your answer

 
discard

posting answer, agree privacy policy , terms of service.

browse other questions tagged or ask own question.

Comments