Compare commits
1
Commits
v1.3.1
...
5717f8aaaa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5717f8aaaa |
No files matched your search
@@ -17,9 +17,12 @@
|
|||||||
//!
|
//!
|
||||||
//! ## Example
|
//! ## Example
|
||||||
//!
|
//!
|
||||||
|
//! Multi-layer + cache-aside composition (default features):
|
||||||
|
//!
|
||||||
//! ```no_run
|
//! ```no_run
|
||||||
//! use mytheclipse_cache::{Cache, MemoryCache, MultiLayerCache, CacheAside};
|
//! # #[cfg(all(feature = "l1-memory", feature = "cache-aside"))]
|
||||||
//! # async fn run() {
|
//! # async fn run() {
|
||||||
|
//! use mytheclipse_cache::{Cache, MemoryCache, MultiLayerCache, CacheAside};
|
||||||
//! let l1 = MemoryCache::new();
|
//! let l1 = MemoryCache::new();
|
||||||
//! let l2 = MemoryCache::new(); // in a real app: a RedisCache
|
//! let l2 = MemoryCache::new(); // in a real app: a RedisCache
|
||||||
//! let cache = MultiLayerCache::new(l1, l2);
|
//! let cache = MultiLayerCache::new(l1, l2);
|
||||||
@@ -34,6 +37,8 @@
|
|||||||
//! );
|
//! );
|
||||||
//! let _v = aside.get("orders:42").await.unwrap();
|
//! let _v = aside.get("orders:42").await.unwrap();
|
||||||
//! # }
|
//! # }
|
||||||
|
//! # #[cfg(not(all(feature = "l1-memory", feature = "cache-aside")))]
|
||||||
|
//! # fn run() {}
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
#![forbid(unsafe_code)]
|
#![forbid(unsafe_code)]
|
||||||
|
|||||||
@@ -15,15 +15,22 @@
|
|||||||
//!
|
//!
|
||||||
//! ## Example
|
//! ## Example
|
||||||
//!
|
//!
|
||||||
//! ```
|
//! Local disk storage (`local` feature, default):
|
||||||
//! use mytheclipse_storage::{LocalFileStorage, StorageDriver, bytes_stream, read_to_vec};
|
//!
|
||||||
//! # #[tokio::main] async fn main() {
|
//! ```no_run
|
||||||
|
//! use mytheclipse_storage::{StorageDriver, bytes_stream, read_to_vec};
|
||||||
|
//! # #[cfg(feature = "local")]
|
||||||
|
//! # #[tokio::main]
|
||||||
|
//! # async fn main() {
|
||||||
|
//! use mytheclipse_storage::LocalFileStorage;
|
||||||
//! # let dir = tempfile::tempdir().unwrap();
|
//! # let dir = tempfile::tempdir().unwrap();
|
||||||
//! let storage = LocalFileStorage::new(dir.path());
|
//! let storage = LocalFileStorage::new(dir.path());
|
||||||
//! storage.put("hello.txt", bytes_stream(b"hi".to_vec())).await.unwrap();
|
//! storage.put("hello.txt", bytes_stream(b"hi".to_vec())).await.unwrap();
|
||||||
//! let data = read_to_vec(storage.get("hello.txt").await.unwrap()).await.unwrap();
|
//! let data = read_to_vec(storage.get("hello.txt").await.unwrap()).await.unwrap();
|
||||||
//! assert_eq!(data, b"hi");
|
//! assert_eq!(data, b"hi");
|
||||||
//! # }
|
//! # }
|
||||||
|
//! # #[cfg(not(feature = "local"))]
|
||||||
|
//! # fn main() {}
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
pub mod traits;
|
pub mod traits;
|
||||||
|
|||||||
Reference in new issue
Block a user