简体   繁体   English

如何从余烬存储中删除已加载的数据?

[英]How do you remove data from the ember store that has been loaded?

As I click on items on my ember app the server is called and the data is loaded in the model store. 当我在余烬应用程序中单击项目时,将调用服务器,并将数据加载到模型存储中。

My question is how can I remove that data that is loaded in for that specific model to be removed, so that when I click on that item again it would call out to the server again and pull the data back. 我的问题是如何删除要删除的特定模型所加载的数据,以便当我再次单击该项目时,它将再次调出服务器并拉回数据。

I have seen some previous answers that running something like, App.store.findQuery(App.Model, {}) , would invalidate the cache, but that does not seem to work. 我以前见过一些答案,运行诸如App.store.findQuery(App.Model, {})类的东西会使缓存无效,但这似乎不起作用。

Is there a way to iterate over just the items that have been loaded into the store and call .reload() on them? 有没有一种方法可以仅对已加载到商店中的商品进行迭代并对其调用.reload() or a way to just clear it all out? 或只是清除所有内容的方法?

Any ideas or help are appreciated. 任何想法或帮助,表示赞赏。

Sounds like what you want to do is unload all of the cached models for a particular type? 听起来您想要做的是卸载特定类型的所有缓存模型?

//From a route or controller...
this.store.unloadAll('post');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM