Joined January 2015
·

Jonah Dempcy

Seattle, WA
·
·

olanger0919, to answer your question:

"Caching the following http://myserver.com/foo/bar/123, what happens to 123 if my next request is http://myserver.com/foo/bar/124? is the previous 123 cached request is being cleared?"

No, the previous 123 cached request is not cleared. It is stored until you close or refresh the page.

If you then check 125, 126, 127 etc and then go back to 123 later, it will load 123 from the cache. (Unless you've closed or reloaded the page, in which case the cache is cleared).

Angular's built in cache functionality in $http works differently than server-side caching in that Angular's cache is cleared every time the page is refreshed. There are other options that let you use, for instance, localStorage and that can persist after a browsing "session" (i.e. after closing or refreshing the page). But the default "cache" option in $http does not retain any cached data beyond the lifecycle of a given pageload.

Achievements
1 Karma
0 Total ProTip Views