Skip to content
This repository has been archived by the owner on Jan 1, 2022. It is now read-only.

cache功能没有利用 #66

Closed
Micraow opened this issue Dec 12, 2020 · 10 comments · Fixed by #76
Closed

cache功能没有利用 #66

Micraow opened this issue Dec 12, 2020 · 10 comments · Fixed by #76
Labels
help wanted Extra attention is needed todo Feature to be implemented

Comments

@Micraow
Copy link

Micraow commented Dec 12, 2020

在原版中,小图片,小文件预览都是走缓存的,包括整式缓存和流式缓存。但在这里,所有预览无论如何,走的都是Microsoft Graph Download URL,很慢,希望改成从cloudflare缓存读取

@stale
Copy link

stale bot commented Dec 19, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Dec 19, 2020
@spencerwooo spencerwooo added help wanted Extra attention is needed todo Feature to be implemented labels Dec 20, 2020
@stale stale bot removed the wontfix This will not be worked on label Dec 20, 2020
@spencerwooo
Copy link
Owner

原版本身也没有预览啊,不知道对比何在?另外什么是「整式缓存和流式缓存」?

@Micraow
Copy link
Author

Micraow commented Jan 4, 2021

抱歉,我的表述有误。说输入那个文件链接之后,可以直接看见文件内容,比如说
https://storage.idx0.workers.dev/Images/abc.jpeg
会直接把图片给显示出来。

然后它原版中有一个缓存功能。worker会通过msgraph 下载链接把文件内容缓存到cloudflare 云端,这样就会很快。

整式缓存是指把整个文件给缓存下来。
流式缓存应该就是把大文件缓存点,然后传给用户,再缓存一点再发给用户。

@beetcb
Copy link
Contributor

beetcb commented Jan 4, 2021

我感觉你的大概意思就是把 ?proxied 的功能应用到预览里面?

@beetcb
Copy link
Contributor

beetcb commented Jan 4, 2021

我感觉你的大概意思就是把 ?proxied 的功能应用到预览里面?

如果是这个需求,我的设想是可以通过在配置里面加个

cachePreview: true 

然后改一下 renderFilePreview 方法,只不过预览那边不知道是否支持这种 cf 缓存的链接 @spencerwooo

@Micraow
Copy link
Author

Micraow commented Jan 4, 2021

chunk缓存的话,好像和代理下载是一样的,但整个文件缓存这种又和代理下载不大同,整个缓存有正确的Content-Length
chunk和代理下载没有

我不太懂js,因为我学的是python ,这里把有关代码贴一下

@Micraow
Copy link
Author

Micraow commented Jan 4, 2021

@beetcb
Copy link
Contributor

beetcb commented Jan 4, 2021

chunk缓存的话,好像和代理下载是一样的,但整个文件缓存这种又和代理下载不大同,整个缓存有正确的Content-Length
chunk和代理下载没有

我不太懂js,因为我学的是python ,这里把有关代码贴一下

对的,这也就是为什么之前的 issue #63 #62 (抱歉,原来引用错了) 是无法实现的,设置了 Transfer-Encoding: chunk 的 header 是无法设置 content-length 的;再说这个 header 是 cf 设定的,我们无法干预

@Micraow
Copy link
Author

Micraow commented Jan 5, 2021

这个我知道了,但缓存预览功能还是值得做出来的

代理下载速度(cdn)基本上1m /s

@spencerwooo spencerwooo linked a pull request Jan 7, 2021 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed todo Feature to be implemented
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants