gfilepool

package
v0.0.0-...-c9a36a8 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

文件指针池

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

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

文件指针池

func New

func New(path string, flag int, expire int) *Pool

创建一个文件指针池,expire < 0表示不过期,expire = 0表示使用完立即回收,expire > 0表示超时回收

func (*Pool) Close

func (p *Pool) Close()

关闭指针池

func (*Pool) File

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

获得一个文件打开指针

type PoolItem

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

文件指针池指针

func OpenWithPool

func OpenWithPool(path string, flag int, expire int) (*PoolItem, error)

获得文件对象,并自动创建指针池

func (*PoolItem) Close

func (f *PoolItem) Close()

关闭指针链接(软关闭),放回池中重复使用

func (*PoolItem) File

func (f *PoolItem) File() *os.File

获得底层文件指针

Jump to

Keyboard shortcuts

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