func (l *list) MoveBefore(e, mark *element) {
	if e.list != l || e == mark {
		return
	}
	l.insert(l.remove(e), mark.prev)
}
MoveBefore moves element e to its new position before mark.
If e is not an element of l, or e == mark, the list is not modified.
package lrucache
type element struct {
	next, prev *element
	list *list
	Value interface{}
}
func (e *element) Next() *element {
	if p := e.next; e.list != nil && p != &e.list.root {
		return p
	}
	return nil
}
func (e *element) Prev() *element {
	if p := e.prev; e.list != nil && p != &e.list.root {
		return p
	}
	return nil
}
type list struct {
	root element  
	len  int      
}
func (l *list) Init() *list {
	l.root.next = &l.root
	l.root.prev = &l.root
	l.len = 0
	return l
}
func (l *list) Len() int { return l.len }
func (l *list) Front() *element {
	if l.len == 0 {
		return nil
	}
	return l.root.next
}
func (l *list) Back() *element {
	if l.len == 0 {
		return nil
	}
	return l.root.prev
}
func (l *list) insert(e, at *element) *element {
	n := at.next
	at.next = e
	e.prev = at
	e.next = n
	n.prev = e
	e.list = l
	l.len++
	return e
}
func (l *list) insertValue(v interface{}, at *element) *element {
	return l.insert(&element{Value: v}, at)
}
func (l *list) remove(e *element) *element {
	e.prev.next = e.next
	e.next.prev = e.prev
	e.next = nil  
	e.prev = nil  
	e.list = nil
	l.len--
	return e
}
func (l *list) Remove(e *element) interface{} {
	if e.list == l {
		l.remove(e)
	}
	return e.Value
}
func (l *list) PushFront(v interface{}) *element {
	return l.insertValue(v, &l.root)
}
func (l *list) PushBack(v interface{}) *element {
	return l.insertValue(v, l.root.prev)
}
func (l *list) InsertBefore(v interface{}, mark *element) *element {
	if mark.list != l {
		return nil
	}
	return l.insertValue(v, mark.prev)
}
func (l *list) InsertAfter(v interface{}, mark *element) *element {
	if mark.list != l {
		return nil
	}
	return l.insertValue(v, mark)
}
func (l *list) MoveToFront(e *element) {
	if e.list != l || l.root.next == e {
		return
	}
	l.insert(l.remove(e), &l.root)
}
func (l *list) MoveToBack(e *element) {
	if e.list != l || l.root.prev == e {
		return
	}
	l.insert(l.remove(e), l.root.prev)
}