Documentation ¶
Index ¶
- func AppendContent(path string, content string) (int, error)
- func CopyFile(src, dst string, isFirstDel ...bool) (err error)
- func Create(path string) (*os.File, error)
- func CronParseLogFile(collectLog string, offset ...int) ([]string, error)
- func Exists(path string) bool
- func GetContent(path string) (string, error)
- func GetProjectDir(projectName string) string
- func Open(path string) (*os.File, error)
- func OpenFile(path string, flag int, perm os.FileMode) (*os.File, error)
- func ParseFileFormat(fileName string) string
- func PutContent(path string, content string) (int, error)
- func Remove(path string) error
- type FileHandle
- type FilePool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendContent ¶ added in v1.1.3
AppendContent 向文件里追加内容
func CronParseLogFile ¶ added in v1.1.9
CronParseLogFile 定时解析增量 log, 返回每行的内容
func PutContent ¶ added in v1.1.3
PutContents 向文件里追加内容
Types ¶
type FileHandle ¶ added in v1.0.2
type FileHandle struct {
// contains filtered or unexported fields
}
FileHandle
func NewFileHandle ¶ added in v1.1.3
func NewFileHandle(path string, expire ...time.Time) *FileHandle
NewFileHandle
func (*FileHandle) GetFile ¶ added in v1.0.2
func (fh *FileHandle) GetFile(flag ...int) *os.File
GetFile 获取文件操作句柄
type FilePool ¶
type FilePool struct {
// contains filtered or unexported fields
}
FilePool 文件池
func NewFilePool ¶
NewFilePool 初始化文件池, 最大 256 个 默认会按 defaultExpireDur 进行淘汰 注: 使用结束需要调用 Close 释放还在内存中的句柄
func (*FilePool) Get ¶
Get 获取文件句柄 注: 1. 调用完需要调用 Put 才能进行复用, 同时句柄不能 Close
- 如果打算不用了的话, 必须调用 *FileHandle.Close 方法进行释放句柄, 防止内存泄露
func (*FilePool) MaxFhCount ¶ added in v1.2.6
MaxFhCount 设置相同 path 时, 最大文件句柄数
Click to show internal directories.
Click to hide internal directories.