Skip to main content

MemoryStore

Struct MemoryStore 

Source
pub struct MemoryStore { /* private fields */ }
Expand description

内存后端。无后台线程 —— 过期判定归 guard,内存回收靠 purge_expired。

Implementations§

Source§

impl MemoryStore

Source

pub fn new() -> Self

Trait Implementations§

Source§

impl Debug for MemoryStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MemoryStore

Source§

fn default() -> Self

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

impl SessionStore for MemoryStore

Source§

fn put(&self, rec: SessionRecord) -> Result<(), StoreError>

Source§

fn get(&self, token: &str) -> Result<Option<SessionRecord>, StoreError>

原样返回记录,不过滤过期。过期判定归 guard —— 若此处对过期记录返回 None,verify 将无法区分 TokenExpired 与 TokenUnknown。
Source§

fn touch(&self, token: &str, now: u64) -> Result<(), StoreError>

Source§

fn revoke(&self, token: &str) -> Result<(), StoreError>

Source§

fn revoke_subject(&self, subject: &str) -> Result<usize, StoreError>

吊销某 subject 的全部会话,返回受影响条数。
Source§

fn recent_logins(&self, subject: &str) -> Result<Vec<LoginPoint>, StoreError>

该 subject 的登录历史,按时间升序(最旧在前)。
Source§

fn record_login( &self, subject: &str, point: LoginPoint, ) -> Result<(), StoreError>

Source§

fn purge_expired(&self, now: u64) -> Result<usize, StoreError>

清除已过期记录,返回清除条数。

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.