code: func (cr *cacheRecord) remove(ctx context.Context, removeSnapshot bool) error {
  	delete(cr.cm.records, cr.ID())
  	if cr.parent != nil {
  		if err := cr.parent.(*immutableRef).release(ctx); err != nil {
  			return err
  		}
  	}
  	if removeSnapshot {
  		if err := cr.cm.Snapshotter.Remove(ctx, cr.ID()); err != nil {
  			return err
  		}
  	}
  	if err := cr.cm.md.Clear(cr.ID()); err != nil {
  		return err
  	}
  	return nil
  }
docs: // call when holding the manager lock