Skip to main content

Module cache

Module cache 

Source
Expand description

HTTP caching infrastructure for Grapsus

This module provides the foundation for HTTP response caching using Pingora’s cache infrastructure.

Current features:

  • Cache configuration per route
  • Cache statistics tracking
  • Cache key generation
  • TTL calculation from Cache-Control headers
  • In-memory cache storage backend (for development/testing)

§Storage Backends

The default storage is an in-memory cache suitable for development and single-instance deployments. For production with large cache sizes or persistence needs, consider implementing a disk-based storage backend.

Structs§

CacheConfig
Cache configuration for a route
CacheManager
Cache manager for HTTP responses
HttpCacheStats
HTTP cache statistics

Functions§

compile_glob_to_regex
Convert a glob-style pattern to a regex pattern.
configure_cache
Configure the global cache storage settings.
get_cache_eviction
Get a static reference to the cache eviction manager
get_cache_lock
Get a static reference to the cache lock
get_cache_storage
Get a static reference to the HTTP cache storage
init_disk_cache_state
Initialize disk cache eviction state at startup.
is_cache_enabled
Check if caching is globally enabled
save_disk_cache_state
Save disk cache eviction state for faster recovery on next startup.