Documentation ¶
Index ¶
- Constants
- Variables
- func New(config *Config, informer logger.Informer) *goCache.Cache
- func NewWithConfigurator(configurator configurator.Configurator, config *Config, ...) *goCache.Cache
- type Cache
- type Config
- type ReConfiguration
- func (reConfiguration *ReConfiguration) Add(k string, x interface{}, d time.Duration) error
- func (reConfiguration *ReConfiguration) Cache() *goCache.Cache
- func (reConfiguration *ReConfiguration) Decrement(k string, n int64) error
- func (reConfiguration *ReConfiguration) DecrementFloat(k string, n float64) error
- func (reConfiguration *ReConfiguration) DecrementFloat32(k string, n float32) (float32, error)
- func (reConfiguration *ReConfiguration) DecrementFloat64(k string, n float64) (float64, error)
- func (reConfiguration *ReConfiguration) DecrementInt(k string, n int) (int, error)
- func (reConfiguration *ReConfiguration) DecrementInt16(k string, n int16) (int16, error)
- func (reConfiguration *ReConfiguration) DecrementInt32(k string, n int32) (int32, error)
- func (reConfiguration *ReConfiguration) DecrementInt64(k string, n int64) (int64, error)
- func (reConfiguration *ReConfiguration) DecrementInt8(k string, n int8) (int8, error)
- func (reConfiguration *ReConfiguration) DecrementUint(k string, n uint) (uint, error)
- func (reConfiguration *ReConfiguration) DecrementUint16(k string, n uint16) (uint16, error)
- func (reConfiguration *ReConfiguration) DecrementUint32(k string, n uint32) (uint32, error)
- func (reConfiguration *ReConfiguration) DecrementUint64(k string, n uint64) (uint64, error)
- func (reConfiguration *ReConfiguration) DecrementUint8(k string, n uint8) (uint8, error)
- func (reConfiguration *ReConfiguration) DecrementUintptr(k string, n uintptr) (uintptr, error)
- func (reConfiguration *ReConfiguration) Delete(k string)
- func (reConfiguration *ReConfiguration) DeleteExpired()
- func (reConfiguration *ReConfiguration) Flush()
- func (reConfiguration *ReConfiguration) Get(k string) (interface{}, bool)
- func (reConfiguration *ReConfiguration) GetWithExpiration(k string) (interface{}, time.Time, bool)
- func (reConfiguration *ReConfiguration) Increment(k string, n int64) error
- func (reConfiguration *ReConfiguration) IncrementFloat(k string, n float64) error
- func (reConfiguration *ReConfiguration) IncrementFloat32(k string, n float32) (float32, error)
- func (reConfiguration *ReConfiguration) IncrementFloat64(k string, n float64) (float64, error)
- func (reConfiguration *ReConfiguration) IncrementInt(k string, n int) (int, error)
- func (reConfiguration *ReConfiguration) IncrementInt16(k string, n int16) (int16, error)
- func (reConfiguration *ReConfiguration) IncrementInt32(k string, n int32) (int32, error)
- func (reConfiguration *ReConfiguration) IncrementInt64(k string, n int64) (int64, error)
- func (reConfiguration *ReConfiguration) IncrementInt8(k string, n int8) (int8, error)
- func (reConfiguration *ReConfiguration) IncrementUint(k string, n uint) (uint, error)
- func (reConfiguration *ReConfiguration) IncrementUint16(k string, n uint16) (uint16, error)
- func (reConfiguration *ReConfiguration) IncrementUint32(k string, n uint32) (uint32, error)
- func (reConfiguration *ReConfiguration) IncrementUint64(k string, n uint64) (uint64, error)
- func (reConfiguration *ReConfiguration) IncrementUint8(k string, n uint8) (uint8, error)
- func (reConfiguration *ReConfiguration) IncrementUintptr(k string, n uintptr) (uintptr, error)
- func (reConfiguration *ReConfiguration) ItemCount() int
- func (reConfiguration *ReConfiguration) Items() map[string]goCache.Item
- func (reConfiguration *ReConfiguration) Load(r io.Reader) error
- func (reConfiguration *ReConfiguration) LoadFile(fname string) error
- func (reConfiguration *ReConfiguration) OnEvicted(f func(string, interface{}))
- func (reConfiguration *ReConfiguration) ReConfiguration(c configurator.Configurator) error
- func (reConfiguration *ReConfiguration) Replace(k string, x interface{}, d time.Duration) error
- func (reConfiguration *ReConfiguration) Save(w io.Writer) (err error)
- func (reConfiguration *ReConfiguration) SaveFile(fname string) error
- func (reConfiguration *ReConfiguration) Set(k string, x interface{}, d time.Duration)
- func (reConfiguration *ReConfiguration) SetDefault(k string, x interface{})
Constants ¶
View Source
const ( ExpirationFieldName = "cache.app.expiration" CleanupIntervalFieldName = "cache.app.cleanup" ExpirationDefault = 5 * time.Minute CleanupIntervalDefault = 10 * time.Minute )
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.DurationVar( &config.Expiration, ExpirationFieldName, ExpirationDefault, "default data retention time", ) flagSet.DurationVar( &config.CleanupInterval, CleanupIntervalFieldName, CleanupIntervalDefault, "period for cleaning the cache from 'rotten' data", ) }) }), 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.app: registration in the reConfigurator") }) }), }
Functions ¶
func NewWithConfigurator ¶
func NewWithConfigurator(configurator configurator.Configurator, config *Config, informer logger.Informer) *goCache.Cache
Types ¶
type Cache ¶
type Cache interface { Set(k string, x interface{}, d time.Duration) SetDefault(k string, x interface{}) Add(k string, x interface{}, d time.Duration) error Replace(k string, x interface{}, d time.Duration) error Get(k string) (interface{}, bool) GetWithExpiration(k string) (interface{}, time.Time, bool) Increment(k string, n int64) error IncrementFloat(k string, n float64) error IncrementInt(k string, n int) (int, error) IncrementInt8(k string, n int8) (int8, error) IncrementInt16(k string, n int16) (int16, error) IncrementInt32(k string, n int32) (int32, error) IncrementInt64(k string, n int64) (int64, error) IncrementUint(k string, n uint) (uint, error) IncrementUintptr(k string, n uintptr) (uintptr, error) IncrementUint8(k string, n uint8) (uint8, error) IncrementUint16(k string, n uint16) (uint16, error) IncrementUint32(k string, n uint32) (uint32, error) IncrementUint64(k string, n uint64) (uint64, error) IncrementFloat32(k string, n float32) (float32, error) IncrementFloat64(k string, n float64) (float64, error) Decrement(k string, n int64) error DecrementFloat(k string, n float64) error DecrementInt(k string, n int) (int, error) DecrementInt8(k string, n int8) (int8, error) DecrementInt16(k string, n int16) (int16, error) DecrementInt32(k string, n int32) (int32, error) DecrementInt64(k string, n int64) (int64, error) DecrementUint(k string, n uint) (uint, error) DecrementUintptr(k string, n uintptr) (uintptr, error) DecrementUint8(k string, n uint8) (uint8, error) DecrementUint16(k string, n uint16) (uint16, error) DecrementUint32(k string, n uint32) (uint32, error) DecrementUint64(k string, n uint64) (uint64, error) DecrementFloat32(k string, n float32) (float32, error) DecrementFloat64(k string, n float64) (float64, error) Delete(k string) DeleteExpired() OnEvicted(f func(string, interface{})) Save(w io.Writer) (err error) SaveFile(fname string) error Load(r io.Reader) error LoadFile(fname string) error Items() map[string]goCache.Item ItemCount() int Flush() }
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(k string, x interface{}, d time.Duration) error
func (*ReConfiguration) Cache ¶
func (reConfiguration *ReConfiguration) Cache() *goCache.Cache
func (*ReConfiguration) Decrement ¶
func (reConfiguration *ReConfiguration) Decrement(k string, n int64) error
func (*ReConfiguration) DecrementFloat ¶
func (reConfiguration *ReConfiguration) DecrementFloat(k string, n float64) error
func (*ReConfiguration) DecrementFloat32 ¶
func (reConfiguration *ReConfiguration) DecrementFloat32(k string, n float32) (float32, error)
func (*ReConfiguration) DecrementFloat64 ¶
func (reConfiguration *ReConfiguration) DecrementFloat64(k string, n float64) (float64, error)
func (*ReConfiguration) DecrementInt ¶
func (reConfiguration *ReConfiguration) DecrementInt(k string, n int) (int, error)
func (*ReConfiguration) DecrementInt16 ¶
func (reConfiguration *ReConfiguration) DecrementInt16(k string, n int16) (int16, error)
func (*ReConfiguration) DecrementInt32 ¶
func (reConfiguration *ReConfiguration) DecrementInt32(k string, n int32) (int32, error)
func (*ReConfiguration) DecrementInt64 ¶
func (reConfiguration *ReConfiguration) DecrementInt64(k string, n int64) (int64, error)
func (*ReConfiguration) DecrementInt8 ¶
func (reConfiguration *ReConfiguration) DecrementInt8(k string, n int8) (int8, error)
func (*ReConfiguration) DecrementUint ¶
func (reConfiguration *ReConfiguration) DecrementUint(k string, n uint) (uint, error)
func (*ReConfiguration) DecrementUint16 ¶
func (reConfiguration *ReConfiguration) DecrementUint16(k string, n uint16) (uint16, error)
func (*ReConfiguration) DecrementUint32 ¶
func (reConfiguration *ReConfiguration) DecrementUint32(k string, n uint32) (uint32, error)
func (*ReConfiguration) DecrementUint64 ¶
func (reConfiguration *ReConfiguration) DecrementUint64(k string, n uint64) (uint64, error)
func (*ReConfiguration) DecrementUint8 ¶
func (reConfiguration *ReConfiguration) DecrementUint8(k string, n uint8) (uint8, error)
func (*ReConfiguration) DecrementUintptr ¶
func (reConfiguration *ReConfiguration) DecrementUintptr(k string, n uintptr) (uintptr, error)
func (*ReConfiguration) Delete ¶
func (reConfiguration *ReConfiguration) Delete(k string)
func (*ReConfiguration) DeleteExpired ¶
func (reConfiguration *ReConfiguration) DeleteExpired()
func (*ReConfiguration) Flush ¶
func (reConfiguration *ReConfiguration) Flush()
func (*ReConfiguration) Get ¶
func (reConfiguration *ReConfiguration) Get(k string) (interface{}, bool)
func (*ReConfiguration) GetWithExpiration ¶
func (reConfiguration *ReConfiguration) GetWithExpiration(k string) (interface{}, time.Time, bool)
func (*ReConfiguration) Increment ¶
func (reConfiguration *ReConfiguration) Increment(k string, n int64) error
func (*ReConfiguration) IncrementFloat ¶
func (reConfiguration *ReConfiguration) IncrementFloat(k string, n float64) error
func (*ReConfiguration) IncrementFloat32 ¶
func (reConfiguration *ReConfiguration) IncrementFloat32(k string, n float32) (float32, error)
func (*ReConfiguration) IncrementFloat64 ¶
func (reConfiguration *ReConfiguration) IncrementFloat64(k string, n float64) (float64, error)
func (*ReConfiguration) IncrementInt ¶
func (reConfiguration *ReConfiguration) IncrementInt(k string, n int) (int, error)
func (*ReConfiguration) IncrementInt16 ¶
func (reConfiguration *ReConfiguration) IncrementInt16(k string, n int16) (int16, error)
func (*ReConfiguration) IncrementInt32 ¶
func (reConfiguration *ReConfiguration) IncrementInt32(k string, n int32) (int32, error)
func (*ReConfiguration) IncrementInt64 ¶
func (reConfiguration *ReConfiguration) IncrementInt64(k string, n int64) (int64, error)
func (*ReConfiguration) IncrementInt8 ¶
func (reConfiguration *ReConfiguration) IncrementInt8(k string, n int8) (int8, error)
func (*ReConfiguration) IncrementUint ¶
func (reConfiguration *ReConfiguration) IncrementUint(k string, n uint) (uint, error)
func (*ReConfiguration) IncrementUint16 ¶
func (reConfiguration *ReConfiguration) IncrementUint16(k string, n uint16) (uint16, error)
func (*ReConfiguration) IncrementUint32 ¶
func (reConfiguration *ReConfiguration) IncrementUint32(k string, n uint32) (uint32, error)
func (*ReConfiguration) IncrementUint64 ¶
func (reConfiguration *ReConfiguration) IncrementUint64(k string, n uint64) (uint64, error)
func (*ReConfiguration) IncrementUint8 ¶
func (reConfiguration *ReConfiguration) IncrementUint8(k string, n uint8) (uint8, error)
func (*ReConfiguration) IncrementUintptr ¶
func (reConfiguration *ReConfiguration) IncrementUintptr(k string, n uintptr) (uintptr, error)
func (*ReConfiguration) ItemCount ¶
func (reConfiguration *ReConfiguration) ItemCount() int
func (*ReConfiguration) Items ¶
func (reConfiguration *ReConfiguration) Items() map[string]goCache.Item
func (*ReConfiguration) LoadFile ¶
func (reConfiguration *ReConfiguration) LoadFile(fname string) error
func (*ReConfiguration) OnEvicted ¶
func (reConfiguration *ReConfiguration) OnEvicted(f func(string, interface{}))
func (*ReConfiguration) ReConfiguration ¶
func (reConfiguration *ReConfiguration) ReConfiguration(c configurator.Configurator) error
func (*ReConfiguration) Replace ¶
func (reConfiguration *ReConfiguration) Replace(k string, x interface{}, d time.Duration) error
func (*ReConfiguration) Save ¶
func (reConfiguration *ReConfiguration) Save(w io.Writer) (err error)
func (*ReConfiguration) SaveFile ¶
func (reConfiguration *ReConfiguration) SaveFile(fname string) error
func (*ReConfiguration) Set ¶
func (reConfiguration *ReConfiguration) Set(k string, x interface{}, d time.Duration)
func (*ReConfiguration) SetDefault ¶
func (reConfiguration *ReConfiguration) SetDefault(k string, x interface{})
Click to show internal directories.
Click to hide internal directories.