func (c *Cache) Add(p *points.Points) {
	s := c.settings.Load().(*cacheSettings)

	if s.xlog != nil {
		p.WriteTo(s.xlog)
		return
	}

	if s.tagsEnabled {
		var err error
		p.Metric, err = tags.Normalize(p.Metric)
		if err != nil {
			atomic.AddUint32(&c.stat.tagsNormalizeErrors, 1)
			return
		}
	}

	// Get map shard.
	count := len(p.Data)

	if s.maxSize > 0 && c.Size() > s.maxSize {
		atomic.AddUint32(&c.stat.overflowCnt, uint32(count))
		return
	}

	shard := c.GetShard(p.Metric)

	shard.Lock()
	if values, exists := shard.items[p.Metric]; exists {
		values.Data = append(values.Data, p.Data...)
	} else {
		shard.items[p.Metric] = p
	}
	shard.Unlock()

	atomic.AddInt32(&c.stat.size, int32(count))
}
func (c *Cache) Add(p *points.Points) {
	s := c.settings.Load().(*cacheSettings)

	if s.xlog != nil {
		p.WriteTo(s.xlog)
		return
	}

	if s.tagsEnabled {
		var err error
		p.Metric, err = tags.Normalize(p.Metric)
		if err != nil {
			atomic.AddUint32(&c.stat.tagsNormalizeErrors, 1)
			return
		}
	}

	
	count := len(p.Data)

	if s.maxSize > 0 && c.Size() > s.maxSize {
		atomic.AddUint32(&c.stat.overflowCnt, uint32(count))
		return
	}

	shard := c.GetShard(p.Metric)

	shard.Lock()
	if values, exists := shard.items[p.Metric]; exists {
		values.Data = append(values.Data, p.Data...)
	} else {
		shard.items[p.Metric] = p
	}
	shard.Unlock()

	atomic.AddInt32(&c.stat.size, int32(count))
}
func ( c * Cache ) Add ( p * points . Points ) { s := c . settings . Load ( ) . ( * cacheSettings ) if s . xlog != nil { p . WriteTo ( s . xlog ) return } if s . tagsEnabled { var err error p . Metric , err = tags . Normalize ( p . Metric ) if err != nil { atomic . AddUint32 ( & c . stat . tagsNormalizeErrors , 1 ) return } } // Get map shard. count := len ( p . Data ) if s . maxSize > 0 && c . Size ( ) > s . maxSize { atomic . AddUint32 ( & c . stat . overflowCnt , uint32 ( count ) ) return } shard := c . GetShard ( p . Metric ) shard . Lock ( ) if values , exists := shard . items [ p . Metric ] ; exists { values . Data = append ( values . Data , p . Data ... ) } else { shard . items [ p . Metric ] = p } shard . Unlock ( ) atomic . AddInt32 ( & c . stat . size , int32 ( count ) ) }
// Sets the given value under the specified key.
Sets the given value under the specified key .