func (c *Cache) StopCleanUp() {
	c.stopCleanUp <- true
}
StopCleanUp stops clean up process.
package geocache
import (
	"errors"
	"sync"
	"time"
	"github.com/shopspring/decimal"
)
type Range int32
const (
	WithIn11KM Range = 1 + iota
	WithIn1KM
	WithIn110M
	WithIn11M
	WithIn1M
	WithIn11CM
	WithIn11MM
	WithIn1MM
)
type Item struct {
	Object     interface{}
	Expiration int64
}
type Cache struct {
	items           map[GeoPoint]Item
	m               sync.RWMutex
	expiration      time.Duration
	cleanUpInterval time.Duration
	precision       int32
	stopCleanUp     chan bool
}
type GeoPoint struct {
	Latitude  float64
	Longitude float64
}
func NewCache(expiration, cleanUpInterval time.Duration, withInRange Range) (*Cache, error) {
	if withInRange < 1 || withInRange > 8 {
		return nil, errors.New("Range must be within 1-8!")
	}
	c := &Cache{items: make(map[GeoPoint]Item), expiration: expiration, cleanUpInterval: cleanUpInterval, precision: int32(withInRange), stopCleanUp: make(chan bool)}
	ticker := time.NewTicker(cleanUpInterval)
	go func() {
		for {
			select {
			case <-ticker.C:
				c.cleanUp()
			case <-c.stopCleanUp:
				ticker.Stop()
				return
			}
		}
	}()
	return c, nil
}
func (c *Cache) Set(position GeoPoint, value interface{}, expiration time.Duration) {
	var exp int64
	if expiration == 0 {
		expiration = c.expiration
	}
	if expiration > 0 {
		exp = time.Now().Add(expiration).UnixNano()
	}
	c.m.Lock()
	defer c.m.Unlock()
	c.items[position.truncate(c.precision)] = Item{Object: value, Expiration: exp}
}
func (c *Cache) Get(position GeoPoint) (interface{}, bool) {
	c.m.RLock()
	defer c.m.RUnlock()
	item, found := c.items[position.truncate(c.precision)]
	return item.Object, found
}
func (c *Cache) Items() map[GeoPoint]Item {
	c.m.RLock()
	defer c.m.RUnlock()
	return c.items
}
func (c *Cache) ItemCount() int {
	c.m.RLock()
	defer c.m.RUnlock()
	n := len(c.items)
	return n
}
func (c *Cache) Flush() {
	c.m.Lock()
	defer c.m.Unlock()
	c.items = map[GeoPoint]Item{}
}