mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
a little bit more efficient
This commit is contained in:
parent
212b6e7d42
commit
3dbd51c3c2
|
@ -58,9 +58,21 @@ func (c *ChunkCache) doGetChunk(fileId string, chunkSize uint64) (data []byte) {
|
|||
return nil
|
||||
}
|
||||
|
||||
for _, diskCache := range c.diskCaches {
|
||||
data := diskCache.getChunk(fid.Key)
|
||||
if len(data) != 0 && len(data) >= int(chunkSize) {
|
||||
if chunkSize < onDiskCacheSizeLimit0 {
|
||||
data = c.diskCaches[0].getChunk(fid.Key)
|
||||
if len(data) >= int(chunkSize) {
|
||||
return data
|
||||
}
|
||||
}
|
||||
if chunkSize < onDiskCacheSizeLimit1 {
|
||||
data = c.diskCaches[1].getChunk(fid.Key)
|
||||
if len(data) >= int(chunkSize) {
|
||||
return data
|
||||
}
|
||||
}
|
||||
{
|
||||
data = c.diskCaches[2].getChunk(fid.Key)
|
||||
if len(data) >= int(chunkSize) {
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue