pub struct FastPathProcessor { /* private fields */ }Expand description
Fast-path request processor for high RPS scenarios
Implements aggressive caching and optimization strategies for frequently accessed resources. Uses in-memory caches with configurable eviction policies and request pattern analysis for optimal performance.
Implementations§
Source§impl FastPathProcessor
impl FastPathProcessor
Sourcepub fn new(router: Arc<Router>, metrics: Arc<PerformanceMetrics>) -> Self
pub fn new(router: Arc<Router>, metrics: Arc<PerformanceMetrics>) -> Self
Create a new fast-path processor
§Arguments
router- The application router for processing requestsmetrics- Metrics collector for performance tracking
Sourcepub async fn process(&self, request: Request) -> Result<Response>
pub async fn process(&self, request: Request) -> Result<Response>
Process a request using fast-path optimizations
Attempts to serve requests from cache when possible, falling back to full router processing for cache misses. Automatically populates the cache with cacheable responses based on HTTP headers.
§Arguments
request- The HTTP request to process
§Returns
The HTTP response, either from cache or freshly generated
§Performance Characteristics
- Cache hits: ~1-2μs response time
- Cache misses: Full router processing time + cache population overhead
- Memory usage: Bounded by cache size limit (default 1000 entries)
Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Clear the response cache
Removes all cached responses. Useful for cache invalidation scenarios or memory management in long-running servers.
Auto Trait Implementations§
impl !RefUnwindSafe for FastPathProcessor
impl !UnwindSafe for FastPathProcessor
impl Freeze for FastPathProcessor
impl Send for FastPathProcessor
impl Sync for FastPathProcessor
impl Unpin for FastPathProcessor
impl UnsafeUnpin for FastPathProcessor
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