Struct cache::bucket::Bucket [−][src]
Fields
timer: u64
timer ID
bucket_instant: u64
instant(seconds from UNIX_EPOCH) at which time bucket begins decrement process
decrement: HashMap<String, u32>
a list of captcha keys that should be decremented during clean up
Implementations
impl Bucket
[src]
pub fn on_delete(
ctx: &Context,
_event_type: NotifyEvent,
_event: &str,
key_name: &str
)
[src]
ctx: &Context,
_event_type: NotifyEvent,
_event: &str,
key_name: &str
)
fn new(ctx: &Context, duration: u64) -> Result<Self, CacheError>
[src]
creates new bucket and sets off timer to go off at duration
fn decrement_runner(ctx: &Context, key: &RedisKeyWritable)
[src]
decrement runner that decrements all registered counts without cleaning after itself use [decrement] when you require auto cleanup. Internally, it calls this method.
fn decrement(ctx: &Context, bucket_instant: u64)
[src]
executes when timer goes off. Decrements all registered counts and cleans itself up
fn increment(ctx: &Context, captcha: &str) -> Result<String, CacheError>
[src]
increments count of key = captcha and registers for auto decrement
pub fn increment_by(
ctx: &Context,
(captcha_name, duration): (String, u64),
increment_by: u32
) -> Result<(), CacheError>
[src]
ctx: &Context,
(captcha_name, duration): (String, u64),
increment_by: u32
) -> Result<(), CacheError>
open bucket, set decrement by specified number
pub fn counter_create(ctx: &Context, args: Vec<String>) -> RedisResult
[src]
Create new counter
Trait Implementations
impl Clone for Bucket
[src]
impl Debug for Bucket
[src]
impl<'de> Deserialize<'de> for Bucket
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for Bucket
[src]
Auto Trait Implementations
impl RefUnwindSafe for Bucket
impl Send for Bucket
impl Sync for Bucket
impl Unpin for Bucket
impl UnwindSafe for Bucket
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,