OpenAgentID documentation
Source referencesRust module referenceoas-resolve

oas-resolve · cache

Declared module signatures, types, configuration, and source documentation.

Source: oas/oas/oas-resolve/src/cache.rs. SHA-256: 58ff23aa2ef2f94c0540dfb51cb76895d205c58b67009f25fbce5a14356d75d1.

This source reference follows declared modules and preserves feature attributes. It includes public declarations and implementation methods in those modules. Private-module exports and trait resolution still require the compiler; not every declaration is a crate-root import. Function bodies and constant values are omitted. Source comments describe their implementation context and are not a production deployment claim.

cache::CachingResolver

A caching wrapper around any [Resolver].

Stores resolved documents in memory with a configurable TTL. Expired entries are lazily evicted on the next access.

Examples

use oas_resolve::cache::CachingResolver;
use oas_resolve::memory::InMemoryResolver;
use std::time::Duration;

let inner = InMemoryResolver::new();
let caching = CachingResolver::new(inner, Duration::from_secs(300));
pub struct CachingResolver<R: Resolver> {

}

Source line: 39.

cache::CachingResolver<R>::new

Creates a new caching resolver.

Arguments

  • inner - The underlying resolver to wrap.
  • ttl - How long to cache resolved documents.
pub fn new(inner: R, ttl: Duration) -> Self;

Source line: 52.

cache::CachingResolver<R>::invalidate

Invalidates a specific cached entry.

Arguments

  • did - The DID to invalidate.
pub fn invalidate(&self, did: &str);

Source line: 65.

cache::CachingResolver<R>::clear

Clears all cached entries.

pub fn clear(&self);

Source line: 72.

cache::CachingResolver<R>::len

Returns the number of entries currently in the cache (including expired).

pub fn len(&self) -> usize;

Source line: 79.

cache::CachingResolver<R>::is_empty

Returns true if the cache is empty.

pub fn is_empty(&self) -> bool;

Source line: 84.

On this page