You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When getting a new TodoItem, Paris will fetch it from the backend:
import{Paris}from"@microsoft/paris";constparis=newParis();// HTTP GET /api/todo/items/1:paris.getItemById(TodoItem,1).subscribe((todoItem:TodoItem)=>{console.log("Todo item with ID 1: ",todoItem);// The next getItemById will be retrieved for cache:paris.getItemById(TodoItem,1).subscribe((todoItem:TodoItem)=>{console.log("I'm cached!");});// However, if 60000 ms have passed, the cached item is invalidated, and an HTTP request is again performed:paris.getItemById(TodoItem,1).subscribe((todoItem:TodoItem)=>{console.log("Again returned from backend!");});});
Caching can also be done for all items and not time-limited:
cache: true
Or a max number of items to cache may be specified: