pub struct TokenCache { /* private fields */ }Expand description
토큰화 캐시
Implementations§
Source§impl TokenCache
impl TokenCache
Sourcepub fn new(config: CacheConfig) -> TokenCache
pub fn new(config: CacheConfig) -> TokenCache
새 캐시 생성
Sourcepub fn with_defaults() -> TokenCache
pub fn with_defaults() -> TokenCache
기본 설정으로 캐시 생성
Sourcepub fn insert(&self, key: u64, tokens: Vec<CachedToken>)
pub fn insert(&self, key: u64, tokens: Vec<CachedToken>)
캐시에 저장
Sourcepub fn get_or_insert<F>(&self, key: u64, compute: F) -> Vec<CachedToken>
pub fn get_or_insert<F>(&self, key: u64, compute: F) -> Vec<CachedToken>
캐시 조회 또는 계산 후 삽입
Sourcepub fn get_or_insert_with_text<F>(
&self,
text: &str,
compute: F,
) -> Vec<CachedToken>
pub fn get_or_insert_with_text<F>( &self, text: &str, compute: F, ) -> Vec<CachedToken>
캐시에서 텍스트로 조회 또는 계산 후 삽입
Sourcepub const fn stats(&self) -> &CacheStats
pub const fn stats(&self) -> &CacheStats
캐시 통계 참조
Sourcepub const fn config(&self) -> &CacheConfig
pub const fn config(&self) -> &CacheConfig
설정 참조
Trait Implementations§
Source§impl Default for TokenCache
impl Default for TokenCache
Source§fn default() -> TokenCache
fn default() -> TokenCache
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for TokenCache
impl RefUnwindSafe for TokenCache
impl Send for TokenCache
impl Sync for TokenCache
impl Unpin for TokenCache
impl UnsafeUnpin for TokenCache
impl UnwindSafe for TokenCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more