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

【bug】缓存总是命中 #8

Open
bob-zebedy opened this issue Nov 15, 2021 · 3 comments
Open

【bug】缓存总是命中 #8

bob-zebedy opened this issue Nov 15, 2021 · 3 comments

Comments

@bob-zebedy
Copy link

https://github.com/klever1988/cachewrtbuild/blob/4e49fc2aa43955b2933541b0372f7416f7dac23d/fetch.js#L18-L19
由于 restoreKeys = ['cache-openwrt']restoreKeys = ['cache-openwrt', 'cache-openwrt-<commithash>']
下面再查缓存的时候
https://github.com/klever1988/cachewrtbuild/blob/4e49fc2aa43955b2933541b0372f7416f7dac23d/fetch.js#L40
keyString 包含时间戳,肯定不会命中,所以会用 restoreKeys 依次去查
但是因为缓存的 key = cache-openwrt-<commithash>-<timestamp>
所以 restoreKeys 中的 cache-openwrt 一定会命中缓存
也就是说不管工具链的commithash有没有发生变化,只要缓存存在就一定会命中,那这个还有什么意义呢?

建议将 restoreKeys 只添加一个 restoreKeys = ['cache-openwrt-<commithash>'] 这样可以根据工具链的 commithash 去命中缓存

@stupidloud
Copy link
Owner

命中了缓存不影响源文件出现变动、也会重新编译变动的那部分呀。
keyString 其实主要还是更新缓存用的,比如如果不用ccache,那么keyString就不会加一个时间戳,多次编译时这个keyString没有变化,Post cache这一步就会自动跳过更新缓存。

@bob-zebedy
Copy link
Author

感谢答疑,还有一个问题,GitHub Action 的缓存是每个仓库5G还是一个人一共5G

@stupidloud
Copy link
Owner

应该是账号5g

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