pub struct TempTokenManager { /* private fields */ }Expand description
Temp-token operations bound to a Dao. 绑定 Dao 的临时令牌操作。
Implementations§
Source§impl TempTokenManager
impl TempTokenManager
Sourcepub fn new(dao: Arc<SaTokenDao>) -> Self
pub fn new(dao: Arc<SaTokenDao>) -> Self
Construct from an existing Dao. 用已有 Dao 构造。
Sourcepub async fn create(
&self,
namespace: &str,
value: Value,
timeout_secs: i64,
record_index: bool,
) -> SaTokenResult<String>
pub async fn create( &self, namespace: &str, value: Value, timeout_secs: i64, record_index: bool, ) -> SaTokenResult<String>
Create a token. timeout_secs < 0 means no TTL.
record_index stores a value→token lookup (one value keeps the latest token).
创建令牌。timeout_secs < 0 表示不设 TTL。
record_index 为 true 时写入 value→token 反查(同一 value 只保留最新 token)。
Sourcepub async fn parse(
&self,
namespace: &str,
token: &str,
) -> SaTokenResult<TempTokenRecord>
pub async fn parse( &self, namespace: &str, token: &str, ) -> SaTokenResult<TempTokenRecord>
Parse and return the record. Missing → NotFound; clock past expire_at → Expired.
解析记录。缺失为 NotFound;已过 expire_at 为 Expired。
Sourcepub async fn find_token(
&self,
namespace: &str,
value: &str,
) -> SaTokenResult<String>
pub async fn find_token( &self, namespace: &str, value: &str, ) -> SaTokenResult<String>
Lookup the latest token for a string value (requires record_index at create).
按字符串业务值反查最新 token(创建时需打开 record_index)。
Trait Implementations§
Source§impl Clone for TempTokenManager
impl Clone for TempTokenManager
Source§fn clone(&self) -> TempTokenManager
fn clone(&self) -> TempTokenManager
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for TempTokenManager
impl !UnwindSafe for TempTokenManager
impl Freeze for TempTokenManager
impl Send for TempTokenManager
impl Sync for TempTokenManager
impl Unpin for TempTokenManager
impl UnsafeUnpin for TempTokenManager
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