mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-18 19:50:25 +08:00
实现自动将热点数据加载到内存中
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
type FileReader struct {
|
||||
fp *os.File
|
||||
|
||||
expiresAt int64
|
||||
status int
|
||||
headerOffset int64
|
||||
headerSize int
|
||||
@@ -43,6 +44,8 @@ func (this *FileReader) Init() error {
|
||||
return ErrNotFound
|
||||
}
|
||||
|
||||
this.expiresAt = int64(binary.BigEndian.Uint32(buf[:SizeExpiresAt]))
|
||||
|
||||
status := types.Int(string(buf[SizeExpiresAt : SizeExpiresAt+SizeStatus]))
|
||||
if status < 100 || status > 999 {
|
||||
return errors.New("invalid status")
|
||||
@@ -78,6 +81,10 @@ func (this *FileReader) TypeName() string {
|
||||
return "disk"
|
||||
}
|
||||
|
||||
func (this *FileReader) ExpiresAt() int64 {
|
||||
return this.expiresAt
|
||||
}
|
||||
|
||||
func (this *FileReader) Status() int {
|
||||
return this.status
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user