Merge pull request #754 from pleshevskiy/task-753

feat: add method to clear types cache
This commit is contained in:
Steven Fackler
2021-04-03 16:49:28 -04:00
committed by GitHub

View File

@@ -113,6 +113,10 @@ impl InnerClient {
self.state.lock().types.insert(oid, type_.clone());
}
pub fn clear_types(&self) {
self.state.lock().types.clear();
}
pub fn with_buf<F, R>(&self, f: F) -> R
where
F: FnOnce(&mut BytesMut) -> R,
@@ -176,6 +180,11 @@ impl Client {
&self.inner
}
/// Clears the cache of database types (domain, enum, composition) that are loaded when preparing a query.
pub fn clear_types_cache(&self) {
self.inner().clear_types()
}
#[cfg(feature = "runtime")]
pub(crate) fn set_socket_config(&mut self, socket_config: SocketConfig) {
self.socket_config = Some(socket_config);