Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrClosed = errors.New("sweep closed")
ErrClosed is the error returned when sweep is closed already.
View Source
var ErrEntryNotFound = errors.New("entry not found")
ErrEntryNotFound is the error returned when an entry doesn't exist in sweep.
View Source
var ErrEntryTooLarge = errors.New("entry is too large in size")
ErrEntryTooLarge is the error returned when an entry is too large going to be put in sweep.
Functions ¶
This section is empty.
Types ¶
type Configuration ¶
type Configuration struct { // ShardsCount represents a fixed number shards sweep will have. // This should be power of two. If it is not, then it will be set // to next power of two greater than current value. ShardsCount int // MaxShardSize represents the upper bound limit of a shard size in bytes. // This can be either 0 or should be power of two. If it is not, // then it will be set to next power of two greater than current // value. A zero value means no restriction on shard size. MaxShardSize int // EntryLifetime represents lifetime of an Entry in the sweep. EntryLifetime time.Duration // MaxEntrySize represents maximum size of Entry in bytes // in sweep can be stored MaxEntrySize int // CleanupInterval represents the waiting period between cleanup // cycles in sweep. CleanupInterval time.Duration }
type Sweep ¶
type Sweep struct {
// contains filtered or unexported fields
}
func Default ¶
func Default() *Sweep
Default return's sweep with default Entry lifetime of 10 minutes and 1000 shards.
func New ¶
func New(cfg Configuration) *Sweep
New return a sweep instance configured to given configuration.
func (*Sweep) EntriesCount ¶
EntriesCount returns number of current entries stored. This count includes those entries too which are expired but not cleaned up yet.
Click to show internal directories.
Click to hide internal directories.