pub struct RedisQueue {
pub connection: String,
pub queue: String,
pub block_for: Option<ExactDuration>,
}Expand description
A connection that keeps jobs in Redis through a named Redis connection, with the redis
driver. Needs the redis feature.
use laravel::config::queue::RedisQueue;
use laravel::time::ToSpan;
let queue = RedisQueue::new()
.connection("queues")
.queue("emails")
.block_for(5.seconds());A queue’s keys start with queues:{name} and have no prefix, so applications that share a
Redis server need different databases. The queue:clear command deletes every job on the
queue, including running jobs.
Fields§
§connection: StringThe name of the Redis connection. The default is default.
queue: StringThe queue that jobs join when they don’t name one.
block_for: Option<ExactDuration>How long a worker waits for a job to be pushed when none is available, or None to return
at once. Waiting needs a connection to one server, not to a cluster.
Implementations§
Source§impl RedisQueue
impl RedisQueue
Sourcepub fn new() -> RedisQueue
pub fn new() -> RedisQueue
Returns a connection that uses the default Redis connection and the default queue, and
doesn’t wait for jobs.
Sourcepub fn from_env(env: &Env) -> RedisQueue
pub fn from_env(env: &Env) -> RedisQueue
Returns a connection that reads REDIS_QUEUE_CONNECTION and REDIS_QUEUE. A variable that
isn’t set keeps the default from RedisQueue::new.
Sourcepub fn connection(self, name: impl Into<String>) -> RedisQueue
pub fn connection(self, name: impl Into<String>) -> RedisQueue
Sets the Redis connection.
Sourcepub fn queue(self, queue: impl Into<String>) -> RedisQueue
pub fn queue(self, queue: impl Into<String>) -> RedisQueue
Sets the queue that jobs join when they don’t name one.
Sourcepub fn block_for(
self,
block_for: impl Into<ZonedDateTimeArithmetic>,
) -> RedisQueue
pub fn block_for( self, block_for: impl Into<ZonedDateTimeArithmetic>, ) -> RedisQueue
Makes a worker wait up to block_for for a job to be pushed when none is available, so the
worker takes the job as soon as it’s pushed. A zero duration doesn’t wait.
Trait Implementations§
Source§impl Clone for RedisQueue
impl Clone for RedisQueue
Source§fn clone(&self) -> RedisQueue
fn clone(&self) -> RedisQueue
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RedisQueue
impl Debug for RedisQueue
Source§impl Default for RedisQueue
impl Default for RedisQueue
Source§fn default() -> RedisQueue
fn default() -> RedisQueue
impl Eq for RedisQueue
Source§impl From<RedisQueue> for ConnectionConfig
impl From<RedisQueue> for ConnectionConfig
Source§fn from(queue: RedisQueue) -> ConnectionConfig
fn from(queue: RedisQueue) -> ConnectionConfig
Source§impl PartialEq for RedisQueue
impl PartialEq for RedisQueue
impl StructuralPartialEq for RedisQueue
Auto Trait Implementations§
impl Forget for RedisQueue
impl Freeze for RedisQueue
impl Move for RedisQueue
impl RefUnwindSafe for RedisQueue
impl Send for RedisQueuewhere
RawVecInner: Send,
impl Sync for RedisQueuewhere
RawVecInner: Sync,
impl Unpin for RedisQueue
impl UnsafeUnpin for RedisQueue
impl UnwindSafe for RedisQueuewhere
RawVecInner: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<K> ForeignKey<K> for K
impl<K> ForeignKey<K> for K
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more