@@ -113,7 +113,7 @@ impl InnerClient {
113
113
self . state . lock ( ) . types . insert ( oid, type_. clone ( ) ) ;
114
114
}
115
115
116
- pub fn clear_types ( & self ) {
116
+ pub fn clear_type_cache ( & self ) {
117
117
self . state . lock ( ) . types . clear ( ) ;
118
118
}
119
119
@@ -180,11 +180,6 @@ impl Client {
180
180
& self . inner
181
181
}
182
182
183
- /// Clears the cache of database types (domain, enum, composition) that are loaded when preparing a query.
184
- pub fn clear_types_cache ( & self ) {
185
- self . inner ( ) . clear_types ( )
186
- }
187
-
188
183
#[ cfg( feature = "runtime" ) ]
189
184
pub ( crate ) fn set_socket_config ( & mut self , socket_config : SocketConfig ) {
190
185
self . socket_config = Some ( socket_config) ;
@@ -493,9 +488,8 @@ impl Client {
493
488
TransactionBuilder :: new ( self )
494
489
}
495
490
496
- /// Constructs a cancellation token that can later be used to request
497
- /// cancellation of a query running on the connection associated with
498
- /// this client.
491
+ /// Constructs a cancellation token that can later be used to request cancellation of a query running on the
492
+ /// connection associated with this client.
499
493
pub fn cancel_token ( & self ) -> CancelToken {
500
494
CancelToken {
501
495
#[ cfg( feature = "runtime" ) ]
@@ -532,6 +526,15 @@ impl Client {
532
526
self . cancel_token ( ) . cancel_query_raw ( stream, tls) . await
533
527
}
534
528
529
+ /// Clears the client's type information cache.
530
+ ///
531
+ /// When user-defined types are used in a query, the client loads their definitions from the database and caches
532
+ /// them for the lifetime of the client. If those definitions are changed in the database, this method can be used
533
+ /// to flush the local cache and allow the new, updated definitions to be loaded.
534
+ pub fn clear_type_cache ( & self ) {
535
+ self . inner ( ) . clear_type_cache ( ) ;
536
+ }
537
+
535
538
/// Determines if the connection to the server has already closed.
536
539
///
537
540
/// In that case, all future queries will fail.
0 commit comments