Skip to content

Commit 1e1f15e

Browse files
committed
Update NRU policy examples to use integer keys and values
- Modified example usages in the NRU policy documentation to utilize integer keys and values instead of strings, enhancing clarity and consistency. - Ensured that examples accurately reflect the expected usage patterns for the NRU cache replacement policy.
1 parent ee33f98 commit 1e1f15e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/policy/nru.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,15 @@ struct Entry<V> {
192192
///
193193
/// let mut cache = NruCache::new(100);
194194
///
195-
/// cache.insert("key1", "value1");
196-
/// cache.insert("key2", "value2");
195+
/// cache.insert(1, "value1");
196+
/// cache.insert(2, "value2");
197197
///
198198
/// // Access sets reference bit
199-
/// assert_eq!(cache.get(&"key1"), Some(&"value1"));
199+
/// assert_eq!(cache.get(&1), Some(&"value1"));
200200
///
201201
/// // When cache is full, unreferenced items are evicted first
202202
/// for i in 3..=110 {
203-
/// cache.insert(i, format!("value{}", i));
203+
/// cache.insert(i, "value");
204204
/// }
205205
///
206206
/// assert_eq!(cache.len(), 100);

0 commit comments

Comments
 (0)