mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-06 01:50:26 +08:00
实现基础的206 partial content缓存
This commit is contained in:
@@ -240,7 +240,7 @@ func (this *APIStream) handleReadCache(message *pb.NodeStreamMessage) error {
|
||||
}()
|
||||
}
|
||||
|
||||
reader, err := storage.OpenReader(msg.Key, false)
|
||||
reader, err := storage.OpenReader(msg.Key, false, false)
|
||||
if err != nil {
|
||||
if err == caches.ErrNotFound {
|
||||
this.replyFail(message.RequestId, "key not found")
|
||||
@@ -351,7 +351,11 @@ func (this *APIStream) handlePurgeCache(message *pb.NodeStreamMessage) error {
|
||||
if msg.Type == "file" {
|
||||
var keys = msg.Keys
|
||||
for _, key := range keys {
|
||||
keys = append(keys, key+webpCacheSuffix, key+cacheMethodSuffix+"HEAD")
|
||||
keys = append(keys,
|
||||
key+cacheMethodSuffix+"HEAD",
|
||||
key+webpCacheSuffix,
|
||||
key+cachePartialSuffix,
|
||||
)
|
||||
// TODO 根据实际缓存的内容进行组合
|
||||
for _, encoding := range compressions.AllEncodings() {
|
||||
keys = append(keys, key+compressionCacheSuffix+encoding)
|
||||
|
||||
Reference in New Issue
Block a user