5

我使用 ormlite 来缓存 sqlite 数据库Robospice。缓存后的数据如下:

表缓存条目(由 robospice 生成

rowid  cachekey      resultclass            resultIntegerId      timestamp
-------------------------------------------------------------------------------
  1      113     com.sq.src.EventResult            3             1381938044268

事件结果

id     data     timestamp
-------------------------
1       121    1381938211268
2       122    1381938444278
3       123    1481938785422 

当时间到期时,robospice 将请求并将新的行数据添加到EventResult.
问题是我只想清除旧数据(清除行 id 1、2 并保留行 id 3),EventResult其中:

getSpiceManager().removeDataFromCache(EventResult.class,113);

但它只清除了cacheentry表中的缓存键行。
而这个清除了所有表中的所有数据。

 getSpiceManager().removeAllDataFromCache();

您能否告诉我如何控制只清除旧数据并使用 robospice 将最新数据保留在表中?提前致谢。

更新EventResult已被许多其他表引用,我必须从它们中清除所有引用行。

4

0 回答 0