gfpool

package
v1.11.5 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2020 License: MIT Imports: 7 Imported by: 4

Documentation

Overview

Package gfpool provides io-reusable pool for file pointer.

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 (*File) Close

func (f *File) Close() error

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

type Pool

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

File pointer pool.

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()

关闭指针池

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