Struct scylla::GenericCachingSession
source · pub struct GenericCachingSession<DeserializationApi, S = RandomState>{ /* private fields */ }
Expand description
Provides auto caching while executing queries
Implementations§
source§impl<DeserApi, S> GenericCachingSession<DeserApi, S>
impl<DeserApi, S> GenericCachingSession<DeserApi, S>
pub fn from(session: GenericSession<DeserApi>, cache_size: usize) -> Self
source§impl<DeserApi, S> GenericCachingSession<DeserApi, S>
impl<DeserApi, S> GenericCachingSession<DeserApi, S>
sourcepub fn with_hasher(
session: GenericSession<DeserApi>,
cache_size: usize,
hasher: S,
) -> Self
pub fn with_hasher( session: GenericSession<DeserApi>, cache_size: usize, hasher: S, ) -> Self
Builds a CachingSession
from a Session
, a cache size,
and a BuildHasher
, using a customer hasher.
source§impl<S> GenericCachingSession<CurrentDeserializationApi, S>where
S: BuildHasher + Clone,
impl<S> GenericCachingSession<CurrentDeserializationApi, S>where
S: BuildHasher + Clone,
sourcepub async fn execute_unpaged(
&self,
query: impl Into<Query>,
values: impl SerializeRow,
) -> Result<QueryResult, QueryError>
pub async fn execute_unpaged( &self, query: impl Into<Query>, values: impl SerializeRow, ) -> Result<QueryResult, QueryError>
Does the same thing as Session::execute_unpaged
but uses the prepared statement cache.
sourcepub async fn execute_iter(
&self,
query: impl Into<Query>,
values: impl SerializeRow,
) -> Result<QueryPager, QueryError>
pub async fn execute_iter( &self, query: impl Into<Query>, values: impl SerializeRow, ) -> Result<QueryPager, QueryError>
Does the same thing as Session::execute_iter
but uses the prepared statement cache.
sourcepub async fn execute_single_page(
&self,
query: impl Into<Query>,
values: impl SerializeRow,
paging_state: PagingState,
) -> Result<(QueryResult, PagingStateResponse), QueryError>
pub async fn execute_single_page( &self, query: impl Into<Query>, values: impl SerializeRow, paging_state: PagingState, ) -> Result<(QueryResult, PagingStateResponse), QueryError>
Does the same thing as Session::execute_single_page
but uses the prepared statement cache.
sourcepub async fn batch(
&self,
batch: &Batch,
values: impl BatchValues,
) -> Result<QueryResult, QueryError>
pub async fn batch( &self, batch: &Batch, values: impl BatchValues, ) -> Result<QueryResult, QueryError>
Does the same thing as Session::batch
but uses the
prepared statement cache.
Prepares batch using CachingSession::prepare_batch
if needed and then executes it.
source§impl<S> GenericCachingSession<LegacyDeserializationApi, S>where
S: BuildHasher + Clone,
impl<S> GenericCachingSession<LegacyDeserializationApi, S>where
S: BuildHasher + Clone,
sourcepub async fn execute_unpaged(
&self,
query: impl Into<Query>,
values: impl SerializeRow,
) -> Result<LegacyQueryResult, QueryError>
👎Deprecated since 0.15.0: Legacy deserialization API is inefficient and is going to be removed soon
pub async fn execute_unpaged( &self, query: impl Into<Query>, values: impl SerializeRow, ) -> Result<LegacyQueryResult, QueryError>
Does the same thing as Session::execute_unpaged
but uses the prepared statement cache.
sourcepub async fn execute_iter(
&self,
query: impl Into<Query>,
values: impl SerializeRow,
) -> Result<LegacyRowIterator, QueryError>
👎Deprecated since 0.15.0: Legacy deserialization API is inefficient and is going to be removed soon
pub async fn execute_iter( &self, query: impl Into<Query>, values: impl SerializeRow, ) -> Result<LegacyRowIterator, QueryError>
Does the same thing as Session::execute_iter
but uses the prepared statement cache.
sourcepub async fn execute_single_page(
&self,
query: impl Into<Query>,
values: impl SerializeRow,
paging_state: PagingState,
) -> Result<(LegacyQueryResult, PagingStateResponse), QueryError>
👎Deprecated since 0.15.0: Legacy deserialization API is inefficient and is going to be removed soon
pub async fn execute_single_page( &self, query: impl Into<Query>, values: impl SerializeRow, paging_state: PagingState, ) -> Result<(LegacyQueryResult, PagingStateResponse), QueryError>
Does the same thing as Session::execute_single_page
but uses the prepared statement cache.
sourcepub async fn batch(
&self,
batch: &Batch,
values: impl BatchValues,
) -> Result<LegacyQueryResult, QueryError>
👎Deprecated since 0.15.0: Legacy deserialization API is inefficient and is going to be removed soon
pub async fn batch( &self, batch: &Batch, values: impl BatchValues, ) -> Result<LegacyQueryResult, QueryError>
Does the same thing as Session::batch
but uses
the prepared statement cache.
Prepares batch using CachingSession::prepare_batch if needed and then executes it.
source§impl<DeserApi, S> GenericCachingSession<DeserApi, S>
impl<DeserApi, S> GenericCachingSession<DeserApi, S>
sourcepub async fn prepare_batch(&self, batch: &Batch) -> Result<Batch, QueryError>
pub async fn prepare_batch(&self, batch: &Batch) -> Result<Batch, QueryError>
Prepares all statements within the batch and returns a new batch where every statement is prepared. Uses the prepared statements cache.
sourcepub async fn add_prepared_statement(
&self,
query: impl Into<&Query>,
) -> Result<PreparedStatement, QueryError>
pub async fn add_prepared_statement( &self, query: impl Into<&Query>, ) -> Result<PreparedStatement, QueryError>
Adds a prepared statement to the cache
pub fn get_max_capacity(&self) -> usize
pub fn get_session(&self) -> &GenericSession<DeserApi>
Trait Implementations§
source§impl<DeserializationApi, S> Debug for GenericCachingSession<DeserializationApi, S>
impl<DeserializationApi, S> Debug for GenericCachingSession<DeserializationApi, S>
Auto Trait Implementations§
impl<DeserializationApi, S> Freeze for GenericCachingSession<DeserializationApi, S>where
S: Freeze,
impl<DeserializationApi, S = RandomState> !RefUnwindSafe for GenericCachingSession<DeserializationApi, S>
impl<DeserializationApi, S> Send for GenericCachingSession<DeserializationApi, S>
impl<DeserializationApi, S> Sync for GenericCachingSession<DeserializationApi, S>
impl<DeserializationApi, S> Unpin for GenericCachingSession<DeserializationApi, S>
impl<DeserializationApi, S = RandomState> !UnwindSafe for GenericCachingSession<DeserializationApi, S>
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> 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