pub struct CachedTactClient { /* private fields */ }Expand description
A caching wrapper around TactClient
Implementations§
Source§impl CachedTactClient
impl CachedTactClient
Sourcepub async fn new(region: Region, protocol: ProtocolVersion) -> Result<Self>
pub async fn new(region: Region, protocol: ProtocolVersion) -> Result<Self>
Create a new cached TACT client
Sourcepub async fn with_cache_dir(
region: Region,
protocol: ProtocolVersion,
cache_dir: PathBuf,
) -> Result<Self>
pub async fn with_cache_dir( region: Region, protocol: ProtocolVersion, cache_dir: PathBuf, ) -> Result<Self>
Create a new cached client with custom cache directory
Sourcepub async fn with_client(client: HttpClient) -> Result<Self>
pub async fn with_client(client: HttpClient) -> Result<Self>
Create from an existing HTTP client
Sourcepub fn set_caching_enabled(&mut self, enabled: bool)
pub fn set_caching_enabled(&mut self, enabled: bool)
Enable or disable caching
Sourcepub async fn get_versions(&self, product: &str) -> Result<Response>
pub async fn get_versions(&self, product: &str) -> Result<Response>
Get versions with caching
Sourcepub async fn get_versions_parsed(
&self,
product: &str,
) -> Result<Vec<VersionEntry>>
pub async fn get_versions_parsed( &self, product: &str, ) -> Result<Vec<VersionEntry>>
Get versions with parsed response and caching
Sourcepub async fn get_cdns(&self, product: &str) -> Result<Response>
pub async fn get_cdns(&self, product: &str) -> Result<Response>
Get CDN configuration with caching
Important: This returns CDN server configuration from the TACT /cdns endpoint,
NOT actual CDN content. The TACT protocol has three metadata endpoints:
/versions- game version information/cdns- CDN server configuration (which CDN servers to use)/bgdl- background download configuration
For actual CDN content caching, use the ngdp-cdn crate with its own caching layer.
Sourcepub async fn get_cdns_parsed(&self, product: &str) -> Result<Vec<CdnEntry>>
pub async fn get_cdns_parsed(&self, product: &str) -> Result<Vec<CdnEntry>>
Get CDN configuration with parsed response and caching
Important: This returns CDN server configuration, NOT actual CDN content.
See get_cdns() documentation for details.
Sourcepub async fn get_bgdl_parsed(&self, product: &str) -> Result<Vec<BgdlEntry>>
pub async fn get_bgdl_parsed(&self, product: &str) -> Result<Vec<BgdlEntry>>
Get BGDL with parsed response and caching
Sourcepub async fn get(&self, path: &str) -> Result<Response>
pub async fn get(&self, path: &str) -> Result<Response>
Get raw response from any path with caching
Sourcepub async fn download_file(
&self,
cdn_host: &str,
path: &str,
hash: &str,
) -> Result<Response>
pub async fn download_file( &self, cdn_host: &str, path: &str, hash: &str, ) -> Result<Response>
Download a file from CDN (no caching for binary files)
Note: This method downloads actual game content from CDN servers and does NOT cache the response. CDN content caching should be implemented in a separate layer (e.g., in ngdp-cdn crate) to handle binary data efficiently with proper storage in ~/.cache/ngdp/cdn/ instead of the TACT metadata cache.
Sourcepub fn inner(&self) -> &HttpClient
pub fn inner(&self) -> &HttpClient
Get the underlying HTTP client
Sourcepub fn inner_mut(&mut self) -> &mut HttpClient
pub fn inner_mut(&mut self) -> &mut HttpClient
Get mutable access to the underlying HTTP client
Sourcepub async fn clear_cache(&self) -> Result<()>
pub async fn clear_cache(&self) -> Result<()>
Clear all cached responses
Sourcepub async fn clear_expired(&self) -> Result<()>
pub async fn clear_expired(&self) -> Result<()>
Clear expired cache entries