gpt4 book ai didi

java - 缓存条目未从缓存存储 (SingleFileCacheStore) 中删除

转载 作者:行者123 更新时间:2023-11-30 09:06:27 24 4
gpt4 key购买 nike

我正在使用 singleFileCacheStore。我已将 maxEntries 设置为 0,并禁用了 passivation

<persistence passivation="false" >  
<singleFile fetchPersistentState="true" preload="true"
ignoreModifications="false"
purgeOnStartup="false" maxEntries="0" >
</singleFile>
</persistence>

在我的应用程序中,我正在触发 cache.remove(key),但我仍然在底层文件中看到条目。

任何线索,有什么问题吗?我是否需要调用任何额外的 API。

最佳答案

一个条目的空间只是被标记,它将被新的或更新的条目重用。因此,在写入新内容之前,您将始终看到旧数据。

处理清除时,文件本身将被截断/缩小。 SingleFileCacheStore 实现非常简单,因此只有在文件末尾有可用空间时才会发生这种情况。如果文件中间某处有可用空间,则不会进行压缩。这并不完美,但已经足够好了,因为缓存中的条目通常总是存在波动。但这意味着,如果您强制清除,文件可能不会被截断,即使有可用空间也是如此。

请参阅 documentation 中的驱逐你如何控制清除。本质上就是:

The purpose of the EvictionManager is to drive the eviction/expiration thread which periodically purges items from the DataContainer. If the eviction thread is disabled (wakeupInterval set to -1) eviction can be kicked off manually using EvictionManager.processEviction(), for example from another maintenance thread that may run periodically in your application.

关于java - 缓存条目未从缓存存储 (SingleFileCacheStore) 中删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24447319/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com