Encapsulate the sharing cache backend better.

MozReview-Commit-ID: 2x9BIhmwH83
This commit is contained in:
Bobby Holley 2017-09-11 11:22:46 -07:00
parent c409c2089c
commit 74b4f95d71
3 changed files with 114 additions and 118 deletions

View file

@ -45,6 +45,16 @@ impl<K: Array> LRUCache<K> {
}
}
/// Returns the front entry in the list (most recently used).
pub fn front(&self) -> Option<&K::Item> {
self.entries.get(0)
}
/// Returns a mutable reference to the front entry in the list (most recently used).
pub fn front_mut(&mut self) -> Option<&mut K::Item> {
self.entries.get_mut(0)
}
/// Iterate over the contents of this cache, from more to less recently
/// used.
pub fn iter(&self) -> arraydeque::Iter<K::Item> {