Documentation
¶
Overview ¶
Package groupcache provides a groupcache backed implementation of darvaza.org/cache
Index ¶
- func NewLogger(l slog.Logger) groupcache.Logger
- func SetLogger(l slog.Logger)
- type Group
- func (g *Group) Get(ctx context.Context, key string, sink cache.Sink) error
- func (g *Group) Name() string
- func (g *Group) Remove(ctx context.Context, key string)
- func (g *Group) Set(ctx context.Context, key string, value []byte, expire time.Time, t cache.Type) error
- func (g *Group) Stats(t cache.Type) cache.Stats
- type HTTPPool
- type HTTPPoolOptions
- type Logger
- func (gcl *Logger) Debug() groupcache.Logger
- func (gcl *Logger) Error() groupcache.Logger
- func (gcl *Logger) ErrorField(label string, err error) groupcache.Logger
- func (gcl *Logger) Info() groupcache.Logger
- func (gcl *Logger) Printf(format string, args ...any)
- func (gcl *Logger) StringField(label string, val string) groupcache.Logger
- func (gcl *Logger) Warn() groupcache.Logger
- func (gcl *Logger) WithFields(fields map[string]any) groupcache.Logger
- type Pool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group implements cache.Cache around a groupcache.Group
type HTTPPool ¶
type HTTPPool struct { Pool // contains filtered or unexported fields }
HTTPPool implements a cache.Store using mailgun's groupcache.HTTPPool.
func NewHTTPPool ¶
NewHTTPPool initialises an HTTP pool of peers, and registers itself as a PeerPicker Due to groupcache's own limitations you have to choose to use either HTTPPool or NoPeersPool. There can be only one.
func NewHTTPPoolOpts ¶
NewHTTPPoolOpts initializes an HTTP pool of peers with the given options. Unlike NewHTTPPool, this function does not register the created pool as an HTTP handler.
Due to groupcache's own limitations you have to choose to use either HTTPPool or NoPeersPool. There can be only one.
type HTTPPoolOptions ¶
type HTTPPoolOptions = groupcache.HTTPPoolOptions
HTTPPoolOptions alias for the NewHTTPPoolOpts wrapper
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is a specific log context for groupcache
func (*Logger) Debug ¶
func (gcl *Logger) Debug() groupcache.Logger
Debug creates a new logger context with level set to Debug
func (*Logger) Error ¶
func (gcl *Logger) Error() groupcache.Logger
Error creates a new logger context with level set to Error
func (*Logger) ErrorField ¶
ErrorField creates a new logger context with a new field containing an error
func (*Logger) Info ¶
func (gcl *Logger) Info() groupcache.Logger
Info creates a new logger context with level set to Info
func (*Logger) Printf ¶
Printf logs a message under a previously set level and with previously set fields
func (*Logger) StringField ¶
StringField creates a new logger context with a new field containing a string value
func (*Logger) Warn ¶
func (gcl *Logger) Warn() groupcache.Logger
Warn creates a new logger context with level set to Warning
func (*Logger) WithFields ¶
WithFields creates a new logger context with a set of new fields of arbitrary value
type Pool ¶
type Pool struct{}
Pool implements a cache.Store using mailgun's groupcache. Groupcache is global so the Pool object doesn't contain anything
func NewNoPeersPool ¶
func NewNoPeersPool() *Pool
NewNoPeersPool initialises groupcache with a PeerPicker that never find a peer Due to groupcache's own limitations you have to choose to use either HTTPPool or NoPeersPool. There can be only one.
func NewPool ¶
func NewPool() *Pool
NewPool creates a Store placeholder to be used as entrypoint to a previously initialised groupcache
func (*Pool) DeregisterCache ¶
DeregisterCache removes a Group from the Pool