Struct cache::bucket::Bucket[][src]

pub struct Bucket {
    timer: u64,
    bucket_instant: u64,
    decrement: HashMap<String, u32>,
}

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]

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]

open bucket, set decrement by specified number

pub fn counter_create(ctx: &Context, args: Vec<RedisString>) -> RedisResult[src]

Create new counter

Trait Implementations

impl Clone for Bucket[src]

impl Debug for Bucket[src]

impl<'de> Deserialize<'de> for Bucket[src]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]