Documentation ¶
Index ¶
- Constants
- type GhostClient
- func (p *GhostClient) CAdd(collectionName string) (string, error)
- func (p *GhostClient) CGet(collectionName string) (string, error)
- func (c *GhostClient) Close() error
- func (p *GhostClient) Del(key string)
- func (p *GhostClient) Get(key string) (string, error)
- func (p *GhostClient) Ping() (*protocol.Reply, error)
- func (p *GhostClient) Process(cmd *protocol.Command)
- func (p *GhostClient) Set(key, val string)
- func (c *GhostClient) String() string
- type Options
- func (opt *Options) GetAddr() string
- func (opt *Options) GetCollectionName() string
- func (opt *Options) GetDialTimeout() time.Duration
- func (opt *Options) GetDialer() func() (net.Conn, error)
- func (opt *Options) GetIdleTimeout() time.Duration
- func (opt *Options) GetMaxRetries() int
- func (opt *Options) GetNetwork() string
- func (opt *Options) GetPoolSize() int
- func (opt *Options) GetPoolTimeout() time.Duration
Constants ¶
View Source
const (
MSG_HEADER_SIZE = 8
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GhostClient ¶
type GhostClient struct { MsgHeader []byte // contains filtered or unexported fields }
func New ¶
func New(opt *Options) *GhostClient
func (*GhostClient) Close ¶
func (c *GhostClient) Close() error
Close the client, releasing any open resources. It is rare to Close a Client, as the Client is meant to be long-lived and shared between many goroutines.
func (*GhostClient) String ¶
func (c *GhostClient) String() string
type Options ¶
type Options struct { // Dialer creates new network connection and has priority // over network and Addr options. Dialer func() (net.Conn, error) // The network type. // Default: tcp. Network string // host:port address. Addr string // Collection name. // Default: "main". CollectionName string // The maximum number of socket connections. // Default: 10 connections. PoolSize int // Specifies amount of time client waits for connection if all // connections are busy before returning an error. // Default: 5 seconds. PoolTimeout time.Duration // Specifies amount of time after which client closes idle connections. // Default: not close idle connections. IdleTimeout time.Duration // Specifies the deadline for establishing new connections. // If reached, dial will fail with a timeout. DialTiemout time.Duration // The maximum number of retries before giving up. // Default is to not retry failed commands. MaxRetries int }
func (*Options) GetCollectionName ¶
func (*Options) GetDialTimeout ¶
func (*Options) GetIdleTimeout ¶
func (*Options) GetMaxRetries ¶
func (*Options) GetNetwork ¶
func (*Options) GetPoolSize ¶
func (*Options) GetPoolTimeout ¶
Click to show internal directories.
Click to hide internal directories.