func (s HashExpireyStrategy) Expired(location string,
	pool *redis.Pool) (expired []string, err error) {
	now := time.Now().UTC()
	cnx := pool.Get()
	defer cnx.Close()
	reply, err := redis.StringMap(cnx.Do("HGETALL", location))
	if err != nil {
		return
	}
	for id, tick := range reply {
		lastUpdate, err := time.Parse(DefaultTimeFormat, tick)
		if err != nil {
			continue
		} else if lastUpdate.Add(s.MaxAge).Before(now) {
			expired = append(expired, id)
		}
	}
	return
}
Expired implements the `func Expired` defined on the Strategy interface. It
scans iteratively over the Heart's `location` field to look for items that
have expired. An item is marked as expired iff the last update time happened
before the instant of the maxAge subtracted from the current time.
package heartbeat
import (
	"time"
	"github.com/garyburd/redigo/redis"
)
const (
	DefaultTimeFormat string = "2006-01-02T15:04:05"
)
type HashExpireyStrategy struct {
	MaxAge time.Duration
}
var _ Strategy = &HashExpireyStrategy{}
func (s HashExpireyStrategy) Touch(location, ID string, pool *redis.Pool) error {
	now := time.Now().UTC().Format(DefaultTimeFormat)
	cnx := pool.Get()
	defer cnx.Close()
	if _, err := cnx.Do("HSET", location, ID, now); err != nil {
		return err
	}
	return nil
}
func (s HashExpireyStrategy) Purge(location, ID string, pool *redis.Pool) error {
	cnx := pool.Get()
	defer cnx.Close()
	if _, err := cnx.Do("HDEL", location, ID); err != nil {
		return err
	}
	return nil
}