pub enum ParallelStrategy {
None,
Batches(usize),
Auto,
}Expand description
Strategy for parallel processing of Redis operations.
Controls how batch fetching is parallelized to improve throughput on large datasets.
§Example
use polars_redis::options::{ScanOptions, ParallelStrategy};
// Use 4 parallel workers for batch fetching
let opts = ScanOptions::new("user:*")
.with_parallel(ParallelStrategy::Batches(4));
// Let the library choose based on dataset size
let opts = ScanOptions::new("user:*")
.with_parallel(ParallelStrategy::Auto);Variants§
None
Sequential processing (default, current behavior).
Keys are scanned and fetched one batch at a time. Best for small datasets or when ordering matters.
Batches(usize)
Parallel batch fetching with N workers.
A single SCAN operation feeds keys to N parallel fetch workers. Each worker fetches data for a subset of keys concurrently.
Recommended values: 2-8 workers depending on Redis server capacity.
Auto
Automatically select strategy based on hints.
- Uses
Nonefor small datasets (< 1000 keys) - Uses
Batches(4)for larger datasets
Implementations§
Source§impl ParallelStrategy
impl ParallelStrategy
Sourcepub fn is_parallel(&self) -> bool
pub fn is_parallel(&self) -> bool
Check if this strategy enables parallel processing.
Sourcepub fn worker_count(&self) -> usize
pub fn worker_count(&self) -> usize
Get the number of workers for this strategy.
Returns 1 for None, the specified count for Batches,
and a default of 4 for Auto.
Sourcepub fn resolve(&self, estimated_keys: Option<usize>) -> ParallelStrategy
pub fn resolve(&self, estimated_keys: Option<usize>) -> ParallelStrategy
Resolve Auto strategy based on estimated key count.
Trait Implementations§
Source§impl Clone for ParallelStrategy
impl Clone for ParallelStrategy
Source§fn clone(&self) -> ParallelStrategy
fn clone(&self) -> ParallelStrategy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParallelStrategy
impl Debug for ParallelStrategy
Source§impl Default for ParallelStrategy
impl Default for ParallelStrategy
Source§fn default() -> ParallelStrategy
fn default() -> ParallelStrategy
Source§impl Hash for ParallelStrategy
impl Hash for ParallelStrategy
Source§impl PartialEq for ParallelStrategy
impl PartialEq for ParallelStrategy
impl Copy for ParallelStrategy
impl Eq for ParallelStrategy
impl StructuralPartialEq for ParallelStrategy
Auto Trait Implementations§
impl Freeze for ParallelStrategy
impl RefUnwindSafe for ParallelStrategy
impl Send for ParallelStrategy
impl Sync for ParallelStrategy
impl Unpin for ParallelStrategy
impl UnwindSafe for ParallelStrategy
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
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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