gf: github.com/gogf/gf/g/os/gfpool Index | Files

package gfpool

import "github.com/gogf/gf/g/os/gfpool"

Package gfpool provides io-reusable pool for file pointer.

Index

Package Files

gfpool.go

type File Uses

type File struct {
    *os.File // 底层文件指针
    // contains filtered or unexported fields
}

文件指针池指针

func Open Uses

func Open(path string, flag int, perm os.FileMode, expire ...int) (file *File, err error)

获得文件对象,并自动创建指针池(过期时间单位:毫秒)

func OpenFile Uses

func OpenFile(path string, flag int, perm os.FileMode, expire ...int) (file *File, err error)

Deprecated. See Open.

func (*File) Close Uses

func (f *File) Close() error

获得底层文件指针(返回error是标准库io.ReadWriteCloser接口实现)

type Pool Uses

type Pool struct {
    // contains filtered or unexported fields
}

File pointer pool.

func New Uses

func New(path string, flag int, perm os.FileMode, expire ...int) *Pool

创建一个文件指针池,expire = 0表示不过期,expire < 0表示使用完立即回收,expire > 0表示超时回收,默认值为0表示不过期。 注意过期时间单位为:毫秒。

func (*Pool) Close Uses

func (p *Pool) Close()

关闭指针池

func (*Pool) File Uses

func (p *Pool) File() (*File, error)

获得一个文件打开指针

Package gfpool imports 7 packages (graph) and is imported by 2 packages. Updated 2019-07-03. Refresh now. Tools for package owners.