mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Encapsulate the sharing cache backend better.
MozReview-Commit-ID: 2x9BIhmwH83
This commit is contained in:
parent
c409c2089c
commit
74b4f95d71
3 changed files with 114 additions and 118 deletions
|
@ -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> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue