backsync

package module
v0.0.0-...-a4a2b2c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2017 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Candidate

type Candidate struct {
	// contains filtered or unexported fields
}

type CandidateByScore

type CandidateByScore []Candidate

func (CandidateByScore) Len

func (a CandidateByScore) Len() int

func (CandidateByScore) Less

func (a CandidateByScore) Less(i, j int) bool

func (CandidateByScore) Swap

func (a CandidateByScore) Swap(i, j int)

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func New

func New(r *redis.Client, itemSetName, updateTimeHashName, inuseTimeHashName string, timeLimit, minIdleTime time.Duration) *Manager

func (*Manager) Add

func (m *Manager) Add(item string) error

func (*Manager) Delete

func (m *Manager) Delete(items []string) error

func (*Manager) Top

func (m *Manager) Top(n int) (items []string, err error)

to probe for 8*n candidate, and return the atmost least-update n items thus, the Top will return least updated 12.5% records, it is quite good approx

if minIdleSec > 0, then the library will only return record with idle time > minIdleSec

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL