Documentation
¶
Overview ¶
Package reaper provides a reaper which checks and removes expired sessions periodically.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Quit ¶
func Quit(quitC chan<- struct{}, doneC <-chan struct{})
Quit terminates the reap goroutine.
func Run ¶
Run invokes a reap function as a goroutine.
Example ¶
// Open a Bolt database.
db, err := bolt.Open("./sessions.db", 0666)
if err != nil {
panic(err)
}
// Close the database when the current function ends.
defer db.Close()
// Invoke a reaper which checks and removes expired sessions periodically.
// Terminate the reaper when the current function ends.
defer Quit(Run(db, Options{}))
Types ¶
type Options ¶
type Options struct {
// BucketName represents the name of the bucket which contains sessions.
BucketName []byte
// BatchSize represents the maximum number of sessions which the reaper
// process at one time.
BatchSize int
// CheckInterval represents the interval between the reaper's invocation.
CheckInterval time.Duration
}
Options represents options for the reaper.
Click to show internal directories.
Click to hide internal directories.