Skip to main content

CdnRefresher

Struct CdnRefresher 

Source
pub struct CdnRefresher {
    pub max_requests_per_minute: u32,
    pub max_targets_per_request: u32,
    /* private fields */
}
Expand description

CDN 刷新器:提交并跟踪 CDN 缓存刷新请求

Fields§

§max_requests_per_minute: u32

每分钟最大刷新请求数

§max_targets_per_request: u32

每次请求最大 URL/目录数量

Implementations§

Source§

impl CdnRefresher

Source

pub fn new() -> Self

Source

pub fn with_rate_limit(self, max_per_minute: u32) -> Self

自定义速率限制

Source

pub fn refresh_urls(&self, urls: Vec<String>) -> Result<String, StorageError>

提交 URL 刷新请求

Source

pub fn refresh_dirs(&self, dirs: Vec<String>) -> Result<String, StorageError>

提交目录刷新请求

Source

pub fn get_status(&self, request_id: &str) -> Option<RefreshStatus>

查询刷新请求状态

Source

pub fn get_request(&self, request_id: &str) -> Option<RefreshRequest>

获取刷新请求详情

Source

pub fn history(&self) -> Vec<RefreshRequest>

返回所有刷新历史

Source

pub fn total_requests(&self) -> usize

返回刷新请求总数

Source

pub fn requests_in_last(&self, seconds: u64) -> usize

返回最近 N 秒内的刷新请求数

Source

pub fn prefetch(&self, urls: Vec<String>) -> Result<String, StorageError>

预热 URL(将内容推送到 CDN 节点)

Trait Implementations§

Source§

impl Default for CdnRefresher

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.