Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
checker wraps some utility methods to work with memcached as duplicate detector
func NewChecker ¶
NewChecker returns a new instance of a Duplicate Detector It can be configured with a special prefix (useful for namespacing different apps) and a TTL (in seconds, either a relative time from now, up to 1 month, or an absolute Unix epoch time. Zero means the items have no expiration time)
func (*Checker) Delete ¶
Delete will remove the item from the cache, allowing a new Item with the same key in
func (*Checker) Has ¶
Has will check if the item has been previously seen already The function could return an error in case Memcache is not reachable or the retrieved value is not what was stored by the duplicate detector
func (*Checker) IsDuplicate ¶
IsDuplicate checks if the ID has been seen before (true) or if it's the first time (false). This counts as a touch: the first time an ID is checked, it is added to the cache; the second time the same ID is checked, it is considered as a duplicate The function could return an error in case Memcache is not reachable