File tree Expand file tree Collapse file tree 3 files changed +18
-9
lines changed Expand file tree Collapse file tree 3 files changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ It is advisable to use another solution if you have the option!
35
35
- Asynchronous APIs
36
36
- Fast and reliable reading/writing
37
37
- Tuned for large-file databases
38
+ - Included cache eviction (LRU/FIFO)
38
39
- Easily accessible value metadata
39
40
- Optimized for cache ` HIT ` s
40
41
- Easy error handling
@@ -44,7 +45,6 @@ It is advisable to use another solution if you have the option!
44
45
45
46
- Toggleable in-memory LRU cache
46
47
- Optional tracking of last-access timestamps
47
- - Included cache eviction (LRU/FIFO)
48
48
- Built-in cache integrity checks
49
49
50
50
## Documentation
Original file line number Diff line number Diff line change @@ -30,11 +30,16 @@ pub(crate) struct Options {
30
30
pub ( crate ) wbuff_sz : usize ,
31
31
}
32
32
33
- /// The main component of `forceps`, acts as the API for interacting with the on-disk API .
33
+ /// The main component of `forceps`, and acts as the API for interacting with the on-disk cache .
34
34
///
35
- /// This structure exposes `read`, `write`, and misc metadata operations. `read` and `write` are
36
- /// both async, whereas all metadata operations are sync. See [`CacheBuilder`](crate::CacheBuilder)
37
- /// for all customization options.
35
+ /// This structure includes the async `read`, `write`, and `remove` operations which are the basic
36
+ /// operations of the cache. It also includes some misc functions to interact with metadata and
37
+ /// evict items from the cache.
38
+ ///
39
+ /// # Eviction
40
+ ///
41
+ /// This cache can evict items with a number of different eviction algorithms. To see more, see
42
+ /// [`evict_with`] and the [`evictors`] module.
38
43
///
39
44
/// # Examples
40
45
///
@@ -49,6 +54,9 @@ pub(crate) struct Options {
49
54
/// .unwrap();
50
55
/// # }
51
56
/// ```
57
+ ///
58
+ /// [`evict_with`]: #method.evict_with
59
+ /// [`evictors`]: crate::evictors
52
60
#[ derive( Debug ) ]
53
61
pub struct Cache {
54
62
meta : MetaDb ,
Original file line number Diff line number Diff line change 14
14
//! - Asynchronous APIs
15
15
//! - Fast and reliable reading/writing
16
16
//! - Tuned for large-file databases
17
+ //! - Included cache eviction (LRU/FIFO)
17
18
//! - Easily accessible value metadata
18
19
//! - Optimized for cache `HIT`s
19
20
//! - Easy error handling
31
32
//!
32
33
//! # Examples
33
34
//!
34
- //! ```rust
35
- //! # # [tokio::main(flavor = "current_thread") ]
36
- //! # async fn main() {
35
+ //! ```rust,no_run
36
+ //! #[tokio::main]
37
+ //! async fn main() {
37
38
//! use forceps::Cache;
38
39
//!
39
40
//! let cache = Cache::new("./cache")
44
45
//! cache.write(b"MY_KEY", b"Hello World").await.unwrap();
45
46
//! let data = cache.read(b"MY_KEY").await.unwrap();
46
47
//! assert_eq!(data.as_ref(), b"Hello World");
47
- //! # }
48
+ //! }
48
49
//! ```
49
50
50
51
#![ warn( missing_docs) ]
You can’t perform that action at this time.
0 commit comments