memcache: increase default capacity to 1024
This commit is contained in:
parent
551eea314a
commit
c30e362d15
1 changed files with 2 additions and 7 deletions
|
@ -22,17 +22,12 @@ pub trait Indexable<I: HashableId>: Clone + Send {
|
|||
|
||||
impl<I: HashableId, T: Indexable<I>> MemCache<I, T> {
|
||||
pub fn new() -> MemCache<I, T> {
|
||||
MemCache::with_capacity(unsafe { NonZeroUsize::new_unchecked(256) })
|
||||
MemCache::with_capacity(NonZeroUsize::new(1024).unwrap())
|
||||
}
|
||||
|
||||
pub fn with_capacity(capacity: NonZeroUsize) -> MemCache<I, T> {
|
||||
let capacity = capacity.get();
|
||||
let mut lines = Vec::with_capacity(capacity);
|
||||
for _ in 0..capacity {
|
||||
lines.push(RwLock::new(None));
|
||||
}
|
||||
MemCache {
|
||||
lines,
|
||||
lines: (0..capacity.get()).map(|_| RwLock::new(None)).collect(),
|
||||
_phantom: PhantomData,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue