S3-FIFO caching
This commit is contained in:
@@ -5,6 +5,7 @@ edition = "2021"
|
||||
resolver = "2"
|
||||
|
||||
[dependencies]
|
||||
utils = { path = "../utils" }
|
||||
xxhash-rust = { version = "0.8.5", features = ["xxh3"] }
|
||||
farmhash = "1.1.5"
|
||||
siphasher = "1.0"
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
use ahash::AHashMap;
|
||||
use radix_trie::TrieKey;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use utils::cache::CacheItemWeight;
|
||||
|
||||
use crate::tokenizers::osb::Gram;
|
||||
|
||||
@@ -142,6 +143,18 @@ impl From<Weights> for i64 {
|
||||
}
|
||||
}
|
||||
|
||||
impl CacheItemWeight for Weights {
|
||||
fn weight(&self) -> u64 {
|
||||
std::mem::size_of::<u64>() as u64
|
||||
}
|
||||
}
|
||||
|
||||
impl CacheItemWeight for TokenHash {
|
||||
fn weight(&self) -> u64 {
|
||||
self.len as u64
|
||||
}
|
||||
}
|
||||
|
||||
impl TokenHash {
|
||||
pub fn serialize_index(prefix: u8, account_id: Option<u32>) -> Vec<u8> {
|
||||
if let Some(account_id) = account_id {
|
||||
|
||||
Reference in New Issue
Block a user