[][src]Struct rocks::cache::CacheBuilder

pub struct CacheBuilder { /* fields omitted */ }

Implementations

impl CacheBuilder[src]

pub fn new_lru(capacity: usize) -> CacheBuilder[src]

Create a new cache with a fixed size capacity. The cache is sharded to 2^num_shard_bits shards, by hash of the key. The total capacity is divided and evenly assigned to each shard. If strict_capacity_limit is set, insert to the cache will fail when cache is full. User can also set percentage of the cache reserves for high priority entries via high_pri_pool_pct. num_shard_bits = -1 means it is automatically determined: every shard will be at least 512KB and number of shard bits will not exceed 6.

pub fn new_clock(capacity: usize) -> CacheBuilder[src]

Similar to NewLRUCache, but create a cache based on CLOCK algorithm with better concurrent performance in some cases. See util/clock_cache.cc for more detail.

Return nullptr if it is not supported.

pub fn build(&mut self) -> Option<Cache>[src]

pub fn num_shard_bits(&mut self, bits: i32) -> &mut Self[src]

pub fn strict_capacity_limit(&mut self, strict: bool) -> &mut Self[src]

pub fn high_pri_pool_ratio(&mut self, ratio: f64) -> &mut Self[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.