Documentation ¶
Index ¶
- Constants
- Variables
- func New(config *Config, informer logger.Informer) *memcache.Client
- func NewWithConfigurator(config *Config, configurator configurator.Configurator, ...) *memcache.Client
- type Cache
- type Config
- type ReConfiguration
- func (reConfiguration *ReConfiguration) Add(item *memcache.Item) error
- func (reConfiguration *ReConfiguration) Append(item *memcache.Item) error
- func (reConfiguration *ReConfiguration) Cache() *memcache.Client
- func (reConfiguration *ReConfiguration) CompareAndSwap(item *memcache.Item) error
- func (reConfiguration *ReConfiguration) Decrement(key string, delta uint64) (newValue uint64, err error)
- func (reConfiguration *ReConfiguration) Delete(key string) error
- func (reConfiguration *ReConfiguration) DeleteAll() error
- func (reConfiguration *ReConfiguration) FlushAll() error
- func (reConfiguration *ReConfiguration) Get(key string) (item *memcache.Item, err error)
- func (reConfiguration *ReConfiguration) GetMulti(keys []string) (map[string]*memcache.Item, error)
- func (reConfiguration *ReConfiguration) Increment(key string, delta uint64) (newValue uint64, err error)
- func (reConfiguration *ReConfiguration) Ping() error
- func (reConfiguration *ReConfiguration) Prepend(item *memcache.Item) error
- func (reConfiguration *ReConfiguration) ReConfiguration(c configurator.Configurator) error
- func (reConfiguration *ReConfiguration) Replace(item *memcache.Item) error
- func (reConfiguration *ReConfiguration) Set(item *memcache.Item) error
- func (reConfiguration *ReConfiguration) Touch(key string, seconds int32) (err error)
Constants ¶
View Source
const ( HostsFieldName = "cache.memcached.hosts" MaxIdleConnections = "cache.memcached.maxIdleConnections" TimeoutFieldName = "cache.memcached.timeout" MaxIdleConnectionsDefault = memcache.DefaultMaxIdleConns TimeoutDefault = memcache.DefaultTimeout )
Variables ¶
View Source
var Component = &app.Component{ Dependencies: app.Components{ logger.Component, configurator.Component, reConfiguration.Component, }, Constructor: app.Constructor(func(container container.Container) error { return container.Provides( NewConfig, NewReConfigurationWithConfigurator, func(reConfiguration *ReConfiguration) Cache { return reConfiguration }, ) }), BindFlags: app.BindFlags(func(flagSet *pflag.FlagSet, container container.Container) error { return container.Invoke(func(config *Config) { flagSet.StringSliceVar(&config.Hosts, HostsFieldName, HostsDefault, "memcached connection hosts") flagSet.Uint16Var(&config.MaxIdleConnections, MaxIdleConnections, MaxIdleConnectionsDefault, "maximum number of idle connections") flagSet.DurationVar(&config.Timeout, TimeoutFieldName, TimeoutDefault, "socket read/write timeout") }) }), Run: app.Run(func(container container.Container) error { return container.Invoke(func( cache *ReConfiguration, reConfiguration reConfiguration.ReConfiguration, informer logger.Informer, config *Config, ) { reConfiguration.Registration(cache) informer.Info("cache.memcached: registration in the reConfigurator") }) }), }
View Source
var HostsDefault = []string{"localhost:11211"}
Functions ¶
func NewWithConfigurator ¶
func NewWithConfigurator(config *Config, configurator configurator.Configurator, informer logger.Informer) *memcache.Client
Types ¶
type Cache ¶
type Cache interface { Add(item *memcache.Item) error Append(item *memcache.Item) error CompareAndSwap(item *memcache.Item) error Decrement(key string, delta uint64) (newValue uint64, err error) Delete(key string) error DeleteAll() error FlushAll() error Get(key string) (item *memcache.Item, err error) GetMulti(keys []string) (map[string]*memcache.Item, error) Increment(key string, delta uint64) (newValue uint64, err error) Ping() error Prepend(item *memcache.Item) error Replace(item *memcache.Item) error Set(item *memcache.Item) error Touch(key string, seconds int32) (err error) }
type Config ¶
func Configuration ¶
func Configuration(config *Config, configurator configurator.Configurator) *Config
type ReConfiguration ¶
type ReConfiguration struct {
// contains filtered or unexported fields
}
func NewReConfiguration ¶
func NewReConfiguration(informer logger.Informer, config *Config) *ReConfiguration
func NewReConfigurationWithConfigurator ¶
func NewReConfigurationWithConfigurator(informer logger.Informer, config *Config, configurator configurator.Configurator) *ReConfiguration
func (*ReConfiguration) Add ¶
func (reConfiguration *ReConfiguration) Add(item *memcache.Item) error
func (*ReConfiguration) Append ¶
func (reConfiguration *ReConfiguration) Append(item *memcache.Item) error
func (*ReConfiguration) Cache ¶
func (reConfiguration *ReConfiguration) Cache() *memcache.Client
func (*ReConfiguration) CompareAndSwap ¶
func (reConfiguration *ReConfiguration) CompareAndSwap(item *memcache.Item) error
func (*ReConfiguration) Decrement ¶
func (reConfiguration *ReConfiguration) Decrement(key string, delta uint64) (newValue uint64, err error)
func (*ReConfiguration) Delete ¶
func (reConfiguration *ReConfiguration) Delete(key string) error
func (*ReConfiguration) DeleteAll ¶
func (reConfiguration *ReConfiguration) DeleteAll() error
func (*ReConfiguration) FlushAll ¶
func (reConfiguration *ReConfiguration) FlushAll() error
func (*ReConfiguration) Get ¶
func (reConfiguration *ReConfiguration) Get(key string) (item *memcache.Item, err error)
func (*ReConfiguration) Increment ¶
func (reConfiguration *ReConfiguration) Increment(key string, delta uint64) (newValue uint64, err error)
func (*ReConfiguration) Ping ¶
func (reConfiguration *ReConfiguration) Ping() error
func (*ReConfiguration) Prepend ¶
func (reConfiguration *ReConfiguration) Prepend(item *memcache.Item) error
func (*ReConfiguration) ReConfiguration ¶
func (reConfiguration *ReConfiguration) ReConfiguration(c configurator.Configurator) error
func (*ReConfiguration) Replace ¶
func (reConfiguration *ReConfiguration) Replace(item *memcache.Item) error
Click to show internal directories.
Click to hide internal directories.