angularjs - How to create a list of recent items from cache? -
I am making a mobile SPA application, using Angrajags and Breeze.
Users of this application are going to be able to see some items and I have to remember this application to see how many items the user viewed and how often. With this information, I want to be able to create a list of "Favorite Items" or "Recent Items"
I am not thinking of saving this information back-end. I want to save this information in the browser cache - as long as the browser cache is not cleared in a while.
How do I do this?
Cookies?
Is there anything to help me achieve this in angular or bridge?
In general, you can use memory cache or local storage in really very good angular plugins , Which makes them very easy to use:
The API in the angle cache is like the methods:
.get (key) .put (key, value). ClearAll () Read more here
Similar to local storage
.get (key) .add (key, value ) .clearAll () Read more here
Apart from this, this blog post has a good overview.
The most interesting thing is that both of these concepts can work together, i.e. some cached content (in memory) can be kept in local storage ... available later, please Check:
Summary : Angular cache and < Code> Local-Storage Plugins provides a very simple and easy API for completion with cache on client
Comments
Post a Comment