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§
source§impl Bucket
impl Bucket
sourcepub fn on_delete(
ctx: &Context,
_event_type: NotifyEvent,
_event: &str,
key_name: &str
)
pub fn on_delete(
ctx: &Context,
_event_type: NotifyEvent,
_event: &str,
key_name: &str
)
Run when bucket timer expired at BUCKET_EXPIRY_OFFSET. Runs scheduled jobs in corresponding if they haven’t already executed
sourcefn new(ctx: &Context, duration: u64) -> Result<Self, CacheError>
fn new(ctx: &Context, duration: u64) -> Result<Self, CacheError>
creates new bucket and sets off timer to go off at duration
sourcefn decrement_runner(ctx: &Context, key: &RedisKeyWritable)
fn decrement_runner(ctx: &Context, key: &RedisKeyWritable)
decrement runner that decrements all registered counts without cleaning after itself use [decrement] when you require auto cleanup. Internally, it calls this method.
sourcefn decrement(ctx: &Context, bucket_instant: u64)
fn decrement(ctx: &Context, bucket_instant: u64)
executes when timer goes off. Decrements all registered counts and cleans itself up
sourcefn increment(ctx: &Context, captcha: &str) -> Result<String, CacheError>
fn increment(ctx: &Context, captcha: &str) -> Result<String, CacheError>
increments count of key = captcha and registers for auto decrement
sourcepub fn increment_by(
ctx: &Context,
(captcha_name, duration): (String, u64),
increment_by: u32
) -> Result<(), CacheError>
pub fn increment_by(
ctx: &Context,
(captcha_name, duration): (String, u64),
increment_by: u32
) -> Result<(), CacheError>
open bucket, set decrement by specified number
sourcepub fn counter_create(ctx: &Context, args: Vec<RedisString>) -> RedisResult
pub fn counter_create(ctx: &Context, args: Vec<RedisString>) -> RedisResult
Create new counter
Trait Implementations§
source§impl<'de> Deserialize<'de> for Bucket
impl<'de> Deserialize<'de> for Bucket
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more