pub struct BatchConfig {
pub pattern: String,
pub batch_size: usize,
pub count_hint: usize,
pub max_rows: Option<usize>,
pub parallel: ParallelStrategy,
}Expand description
Configuration for batch iteration.
This struct configures how keys are scanned and batched when reading from Redis. It supports environment variable defaults:
POLARS_REDIS_BATCH_SIZE: Default batch size (default: 1000)POLARS_REDIS_COUNT_HINT: Default SCAN COUNT hint (default: 100)
§Example
ⓘ
use polars_redis::BatchConfig;
let config = BatchConfig::new("user:*")
.with_batch_size(500)
.with_count_hint(200)
.with_max_rows(10000);Fields§
§pattern: StringKey pattern to match (e.g., “user:*”).
batch_size: usizeNumber of keys to process per batch.
count_hint: usizeSCAN COUNT hint for Redis.
max_rows: Option<usize>Maximum total rows to return (None for unlimited).
parallel: ParallelStrategyParallel processing strategy.
Implementations§
Source§impl BatchConfig
impl BatchConfig
Sourcepub fn new(pattern: impl Into<String>) -> Self
pub fn new(pattern: impl Into<String>) -> Self
Create a new BatchConfig with the given pattern.
Sourcepub fn with_batch_size(self, size: usize) -> Self
pub fn with_batch_size(self, size: usize) -> Self
Set the batch size.
Sourcepub fn with_count_hint(self, count: usize) -> Self
pub fn with_count_hint(self, count: usize) -> Self
Set the COUNT hint for SCAN.
Sourcepub fn with_max_rows(self, max: usize) -> Self
pub fn with_max_rows(self, max: usize) -> Self
Set the maximum number of rows to return.
Sourcepub fn with_parallel(self, strategy: ParallelStrategy) -> Self
pub fn with_parallel(self, strategy: ParallelStrategy) -> Self
Set the parallel processing strategy.
Trait Implementations§
Source§impl Clone for BatchConfig
impl Clone for BatchConfig
Source§fn clone(&self) -> BatchConfig
fn clone(&self) -> BatchConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BatchConfig
impl Debug for BatchConfig
Source§impl Default for BatchConfig
impl Default for BatchConfig
Source§impl From<BatchConfig> for ScanOptions
impl From<BatchConfig> for ScanOptions
Source§fn from(config: BatchConfig) -> Self
fn from(config: BatchConfig) -> Self
Converts to this type from the input type.
Source§impl From<ScanOptions> for BatchConfig
impl From<ScanOptions> for BatchConfig
Source§fn from(opts: ScanOptions) -> Self
fn from(opts: ScanOptions) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for BatchConfig
impl RefUnwindSafe for BatchConfig
impl Send for BatchConfig
impl Sync for BatchConfig
impl Unpin for BatchConfig
impl UnwindSafe for BatchConfig
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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