Documentation ¶
Overview ¶
Package memcache implements a memcache adapter for github.com/hamba/pkg/cache.
Index ¶
- type Memcache
- func (c Memcache) Add(key string, value interface{}, expire time.Duration) error
- func (c Memcache) Dec(key string, value uint64) (int64, error)
- func (c Memcache) Delete(key string) error
- func (c Memcache) Get(key string) cache.Item
- func (c Memcache) GetMulti(keys ...string) ([]cache.Item, error)
- func (c Memcache) Inc(key string, value uint64) (int64, error)
- func (c Memcache) Replace(key string, value interface{}, expire time.Duration) error
- func (c Memcache) Set(key string, value interface{}, expire time.Duration) error
- type OptsFunc
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Memcache ¶
type Memcache struct {
// contains filtered or unexported fields
}
Memcache is a memcache adapter.
func New ¶
New create a new Memcache instance.
Example ¶
package main import ( "time" "github.com/hamba/cache/memcache" ) func main() { c := memcache.New("localhost:11211", memcache.WithIdleConns(10), memcache.WithTimeout(10*time.Millisecond)) i := c.Get("foobar") if i.Err != nil { // Handle error } _, _ = i.Float64() }
Output:
type OptsFunc ¶
OptsFunc represents an configuration function for Memcache.
func WithIdleConns ¶
WithIdleConns configures the Memcache max idle connections.
func WithTimeout ¶
WithTimeout configures the Memcache read and write timeout.
Click to show internal directories.
Click to hide internal directories.