dcounter

package
v0.2.1-0...-a6904e9 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2015 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package pool provides a simple blocking connection pool.

package main

import (
	"fmt"
	"github.com/atomx/dcounter/pool"
)

func main() {
	p := dcounter.New("tcp", "127.0.0.1:9374", 32)

	d, err := p.Get(time.Second)
	if err != nil {
		panic(err)
	}
	defer p.Put(d)

	fmt.Println(d.Get("test"))
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

type Pool chan api.API

Pool implements a simple blocking connection pool.

func New

func New(network, addr string, size int) Pool

func (Pool) Get

func (p Pool) Get(timeout time.Duration) (api.API, error)

Get gets a connection from the pool. A zero or negative timeout causes Get to wait as long as it takes to get a connection.

func (Pool) Put

func (p Pool) Put(a api.API)

Jump to

Keyboard shortcuts

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