Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

umi3设置了cacheKey和cacheTime, 但是缓存不生效 #2752

Open
BuyTmall opened this issue Mar 31, 2025 · 1 comment
Open

umi3设置了cacheKey和cacheTime, 但是缓存不生效 #2752

BuyTmall opened this issue Mar 31, 2025 · 1 comment

Comments

@BuyTmall
Copy link

BuyTmall commented Mar 31, 2025

const { loading, run } = useRequest(
(data) =>
request('./API/api/resrce/query', {
method: 'POST',
timeout: 90000,
data: {
resourceCode: '1103',
parameter: {
...data
}
}
}),
{
manual: true,
throttleInterval: 500,
cacheKey: 'TextQuest',
staleTime: 300000,
onSuccess(data) { }
}
);

设置了 cacheKey: 'TextQuest',
cacheTime: 300000,

但是在5分钟内, 再次请求还是 发起了网络请求, 仿佛缓存没有生效, 这是因为什么?

@LiryCcc
Copy link

LiryCcc commented Apr 4, 2025

可以放在代码块里面吗,看起来更清楚一点

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants