Struct deadpool_postgres::StatementCache [−][src]
pub struct StatementCache { /* fields omitted */ }
Expand description
Representation of a cache of Statement
s.
StatementCache
is bound to one Client
, and Statement
s generated
by that Client
must not be used with other Client
s.
It can be used like that:
let client = pool.get().await?;
let stmt = client
.statement_cache
.prepare(&client, "SELECT 1")
.await;
let rows = client.query(stmt, &[]).await?;
...
Normally, you probably want to use the ClientWrapper::prepare_cached()
and ClientWrapper::prepare_typed_cached()
methods instead (or the
similar ones on Transaction
).
Implementations
Returns current size of this StatementCache
.
Clears this StatementCache
.
Important: This only clears the StatementCache
of one Client
instance. If you want to clear the StatementCache
of all Client
s
you should be calling pool.manager().statement_caches.clear()
instead.
Removes a Statement
from this StatementCache
.
Important: This only removes a Statement
from one Client
cache. If you want to remove a Statement
from all
StatementCaches
you should be calling
pool.manager().statement_caches.remove()
instead.
Creates a new prepared Statement
using this StatementCache
, if
possible.
Creates a new prepared Statement
with specifying its Type
s
explicitly using this StatementCache
, if possible.