Discover Packages
github.com/huizluo/kratos
pkg
container
group
package
Version:
v0.0.0-...-3ecd8c4
Opens a new window with list of versions in this module.
Published: Feb 26, 2020
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README Documentation Source Files 项目简介 编译环境 依赖包 Overview Index Constants Variables Functions Types Examples type Group NewGroup(new) (g) Clear() (g) Get(key) (g) Reset(new)
README
¶
group
项目简介
懒加载对象容器
编译环境
推荐 Golang v1.12.1 以上版本编译执行
依赖包
Expand ▾
Collapse ▴
Documentation
¶
Package group provides a sample lazy load container.
The group only creating a new object not until the object is needed by user.
And it will cache all the objects to reduce the creation of object.
Group is a lazy load container.
func NewGroup(new func() interface{}) *Group
NewGroup news a group container.
Clear deletes all objects.
Get gets the object by the given key.
func (g *Group ) Reset(new func() interface{})
Reset resets the new function and deletes all existing objects.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.