File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed
crates/rspack_core/src/artifacts Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -150,32 +150,26 @@ pub(super) mod get_side_effects_connection_state {
150
150
}
151
151
152
152
pub ( super ) mod get_exports_type {
153
- use super :: * ;
154
153
use crate :: { ExportsType , ModuleIdentifier } ;
155
154
156
155
pub type GetExportsTypeCacheKey = ( ModuleIdentifier , bool ) ;
157
156
158
157
#[ derive( Debug , Default ) ]
159
158
pub struct GetExportsTypeCache {
160
- cache : RwLock < HashMap < GetExportsTypeCacheKey , ExportsType > > ,
159
+ cache : dashmap :: DashMap < GetExportsTypeCacheKey , ExportsType > ,
161
160
}
162
161
163
162
impl GetExportsTypeCache {
164
163
pub fn freeze ( & self ) {
165
- self . cache . write ( ) . expect ( "should get lock" ) . clear ( ) ;
164
+ self . cache . clear ( ) ;
166
165
}
167
166
168
167
pub fn get ( & self , key : & GetExportsTypeCacheKey ) -> Option < ExportsType > {
169
- let inner = self . cache . read ( ) . expect ( "should get lock" ) ;
170
- inner. get ( key) . copied ( )
168
+ self . cache . get ( key) . map ( |x| * x)
171
169
}
172
170
173
171
pub fn set ( & self , key : GetExportsTypeCacheKey , value : ExportsType ) {
174
- self
175
- . cache
176
- . write ( )
177
- . expect ( "should get lock" )
178
- . insert ( key, value) ;
172
+ self . cache . insert ( key, value) ;
179
173
}
180
174
}
181
175
}
You can’t perform that action at this time.
0 commit comments