Example #1
0
// NewRangeDescriptorCache returns a new RangeDescriptorCache which
// uses the given rangeDescriptorDB as the underlying source of range
// descriptors.
func NewRangeDescriptorCache(db rangeDescriptorDB) *RangeDescriptorCache {
	return &RangeDescriptorCache{
		db: db,
		rangeCache: util.NewOrderedCache(util.CacheConfig{
			Policy:      util.CacheLRU,
			ShouldEvict: rangeCacheShouldEvict,
		}),
	}
}
Example #2
0
// NewRangeMetadataCache returns a new RangeMetadataCache which uses the given
// RangeMetadataDB as the underlying source of range metadata.
func NewRangeMetadataCache(db RangeMetadataDB) *RangeMetadataCache {
	return &RangeMetadataCache{
		db: db,
		rangeCache: util.NewOrderedCache(util.CacheConfig{
			Policy:      util.CacheLRU,
			ShouldEvict: rangeCacheShouldEvict,
		}),
	}
}