gfpool

package
v1.1.994 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

文件指针池

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

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

文件指针池指针

func Open

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

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

func OpenFile

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

func (*File) Close

func (f *File) Close() error

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

type Pool

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

文件指针池

func New

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

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

func (*Pool) Close

func (p *Pool) Close() error

关闭指针池(返回error是标准库io.ReadWriteCloser接口实现)

func (*Pool) File

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

获得一个文件打开指针

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL