You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: cache.rs
    path of file: ./repos/feather/feather/common/src/chunk
    
    the code of the file until where you have to start completion: use std::{
    collections::VecDeque,
    sync::Arc,
    time::{Duration, Instant},
};

use ahash::AHashMap;
use base::{ChunkHandle, ChunkPosition};

#[cfg(not(test))]
const CACHE_TIME: Duration = Duration::from_secs(30);
#[cfg(test)]
const CACHE_TIME: Duration = Duration::from_millis(500);

/// This struct contains chunks that were unloaded but remain in memory in case they are needed.
#[derive(Default)]
pub struct ChunkCache {
    map: AHashMap<ChunkPosition, (Instant, ChunkHandle)>, // expire time + handle
    unload_queue: VecDeque<ChunkPosition>
    
    fn purge_old_unused() {
        let mut cache = ChunkCache::new();
        let mut stored_handles: Vec<ChunkHandle> = vec![];
        let mut used_count = 0;
        for i in 0..100 {
            let handle = Arc::new(ChunkLock::new(Chunk::new(ChunkPosition::new(i, 0)), false));
            if rand::random::<bool>() {
                // clone this handle and pretend it is used
                used_count += 1;
                stored_handles.push(handle.clone());
            }
            assert!(cache.insert_read_pos(handle).is_none());
        }
        cache.purge_old_unused();
        assert_eq!(cache.len(), 100);
        sleep(CACHE_TIME);
        sleep(CACHE_TIME);
        assert_eq!(cache.len(), 100);
        cache.purge_old_unused();
        assert_eq!(cache.len(), used_count);
    }