From 885e69cf649caf2ccea3731ab8fac68ea5da3848 Mon Sep 17 00:00:00 2001 From: ssfdust Date: Thu, 9 Jan 2025 19:38:20 +0800 Subject: [PATCH] doc: add documents for admission picker --- docs/05-design/02-admission-picker.md | 21 +++++++++++++++++++ docusaurus.config.ts | 2 +- .../05-design/02-admission-picker.md | 21 +++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 docs/05-design/02-admission-picker.md create mode 100644 versioned_docs/version-0.12/05-design/02-admission-picker.md diff --git a/docs/05-design/02-admission-picker.md b/docs/05-design/02-admission-picker.md new file mode 100644 index 0000000..ba04c50 --- /dev/null +++ b/docs/05-design/02-admission-picker.md @@ -0,0 +1,21 @@ +# Admission Picker + +## What is the admission picker? + +The admission picker is used to determine whether the entry should be inserted +into the disk cache. It is a component of the hybrid cache. + +You can use it when you create a hybrid cache. For example: + +```rust + let hybrid: HybridCache = HybridCacheBuilder::new() + .memory(64 * 1024 * 1024) + .storage(Engine::Large) + .with_admission_picker(Arc::new(RateLimitPicker::new(100 * 1024 * 1024))) + .build() + .await?; +``` + +## Admission types + +### RateLimitPicker diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 04f15a0..558e1f7 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -42,7 +42,7 @@ const config: Config = { // Remove this to remove the "edit this page" links. editUrl: 'https://github.com/foyer-rs/website/tree/main/', - includeCurrentVersion: false, + includeCurrentVersion: true, }, blog: { showReadingTime: true, diff --git a/versioned_docs/version-0.12/05-design/02-admission-picker.md b/versioned_docs/version-0.12/05-design/02-admission-picker.md new file mode 100644 index 0000000..ba04c50 --- /dev/null +++ b/versioned_docs/version-0.12/05-design/02-admission-picker.md @@ -0,0 +1,21 @@ +# Admission Picker + +## What is the admission picker? + +The admission picker is used to determine whether the entry should be inserted +into the disk cache. It is a component of the hybrid cache. + +You can use it when you create a hybrid cache. For example: + +```rust + let hybrid: HybridCache = HybridCacheBuilder::new() + .memory(64 * 1024 * 1024) + .storage(Engine::Large) + .with_admission_picker(Arc::new(RateLimitPicker::new(100 * 1024 * 1024))) + .build() + .await?; +``` + +## Admission types + +### RateLimitPicker