Copyright 2019, OpenCensus Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

package trace

import (
	
)
A simple lru.Cache wrapper that tracks the keys of the current contents and the cumulative number of evicted items.
type lruMap struct {
	cacheKeys    map[lru.Key]bool
	cache        *lru.Cache
	droppedCount int
}

func ( int) *lruMap {
	 := &lruMap{
		cacheKeys:    make(map[lru.Key]bool),
		cache:        lru.New(),
		droppedCount: 0,
	}
	.cache.OnEvicted = func( lru.Key,  interface{}) {
		delete(.cacheKeys, )
		.droppedCount++
	}
	return 
}

func ( lruMap) () int {
	return .cache.Len()
}

func ( lruMap) () []interface{} {
	 := make([]interface{}, len(.cacheKeys))
	for  := range .cacheKeys {
		 = append(, )
	}
	return 
}

func ( *lruMap) (,  interface{}) {
	.cacheKeys[lru.Key()] = true
	.cache.Add(lru.Key(), )
}

func ( *lruMap) ( interface{}) (interface{}, bool) {
	return .cache.Get()