func (p WOFPointInPolygon) LoadPolygonsForFeature(feature *geojson.WOFFeature) ([]*geojson.WOFPolygon, error) { id := feature.Id() polygons := feature.GeomToPolygons() var points int for _, pl := range polygons { points += pl.CountPoints() } p.Logger.Debug("%d has %d points", id, points) if points >= p.CacheTrigger { p.Logger.Debug("caching %d because it has E_EXCESSIVE_POINTS (%d)", id, points) var c metrics.Counter c = *p.Metrics.CountCacheSet evicted := p.Cache.Add(id, polygons) if evicted == true { cache_size := p.CacheSize cache_set := c.Count() p.Logger.Warning("starting to push thing out of the cache %d sets on a cache size of %d", cache_set, cache_size) } go c.Inc(1) } return polygons, nil }
func (idx *WOFIndex) LoadPolygonsForFeature(feature *geojson.WOFFeature) ([]*geojson.WOFPolygon, error) { id := feature.Id() polygons := feature.GeomToPolygons() var points int for _, pl := range polygons { points += pl.CountPoints() } idx.Logger.Debug("%d has %d points", id, points) if points >= idx.CacheTrigger { idx.Logger.Debug("caching %d because it has E_EXCESSIVE_POINTS (%d)", id, points) evicted := idx.Cache.Add(id, polygons) if evicted == true { idx.Logger.Warning("starting to push thing out of the cache") } } return polygons, nil }