src/server/pkg/hashtree/cache.go
func NewCache(size int) (*Cache, error) {
	c, err := lru.NewWithEvict(size, func(key interface{}, value interface{}) {
		go func() {
			tree, ok := value.(*dbHashTree)
			if !ok {
				logrus.Infof("non hashtree slice value of type: %v", reflect.TypeOf(value))
				return
			}
			if err := tree.Destroy(); err != nil {
				logrus.Infof("failed to destroy hashtree: %v", err)
			}
		}()
	})
	if err != nil {
		return nil, err
	}
	return &Cache{c}, nil
}
func NewCache(size int) (*Cache, error) {
	c, err := lru.NewWithEvict(size, func(key interface{}, value interface{}) {
		go func() {
			tree, ok := value.(*dbHashTree)
			if !ok {
				logrus.Infof("non hashtree slice value of type: %v", reflect.TypeOf(value))
				return
			}
			if err := tree.Destroy(); err != nil {
				logrus.Infof("failed to destroy hashtree: %v", err)
			}
		}()
	})
	if err != nil {
		return nil, err
	}
	return &Cache{c}, nil
}
// NewCache creates a new cache.