Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitGroupCacheRes ¶
InitGroupCacheRes init the resources for groupcache init this in the handler provision stage.
Types ¶
type Backend ¶
type Backend interface {
io.Writer
io.Closer
Clean() error
Flush() error
GetReader() (io.ReadCloser, error)
}
Backend is the cache storage backend.
func NewFileBackend ¶
NewFileBackend new a disk storage backend
func NewInMemoryBackend ¶
NewInMemoryBackend get the singleton of groupcache
func WrapResponseWriterToBackend ¶
func WrapResponseWriterToBackend(w http.ResponseWriter) Backend
type Base ¶
type Base struct {
// contains filtered or unexported fields
}
Base wraps the http.ResponseWriter to match the Backend interface
type FileBackend ¶
type FileBackend struct {
// contains filtered or unexported fields
}
FileBackend saves the content into a file
func (*FileBackend) Clean ¶
func (f *FileBackend) Clean() error
func (*FileBackend) Close ¶
func (f *FileBackend) Close() error
func (*FileBackend) GetReader ¶
func (f *FileBackend) GetReader() (io.ReadCloser, error)
type FileReader ¶
type FileReader struct {
// contains filtered or unexported fields
}
FileReader is the common code to read the storages until the subscription channel is closed
type InMemoryBackend ¶
type InMemoryBackend struct {
Ctx context.Context
Key string
// contains filtered or unexported fields
}
InMemoryBackend saves the content into inmemory with the groupcache.
func (*InMemoryBackend) Clean ¶
func (i *InMemoryBackend) Clean() error
func (*InMemoryBackend) Close ¶
func (i *InMemoryBackend) Close() error
func (*InMemoryBackend) Flush ¶
func (i *InMemoryBackend) Flush() error
func (*InMemoryBackend) GetReader ¶
func (i *InMemoryBackend) GetReader() (io.ReadCloser, error)
type RedisBackend ¶
type RedisBackend struct {
}
type Subscription ¶
type Subscription struct {
// contains filtered or unexported fields
}
Subscription ..
func NewSubscription ¶
func NewSubscription() *Subscription
func (*Subscription) Close ¶
func (s *Subscription) Close()
func (*Subscription) NewSubscriber ¶
func (s *Subscription) NewSubscriber() <-chan int
func (*Subscription) NotifyAll ¶
func (s *Subscription) NotifyAll(newBytes int)
func (*Subscription) RemoveSubscriber ¶
func (s *Subscription) RemoveSubscriber(subscriber <-chan int)
func (*Subscription) WaitAll ¶
func (s *Subscription) WaitAll()
Click to show internal directories.
Click to hide internal directories.