@@ -84,7 +84,6 @@ class OnyxCache {
8484 'addLastAccessedKey' ,
8585 'addAllSafeEvictionKeysToRecentlyAccessedList' ,
8686 'getKeyForEviction' ,
87- 'getRecentKeysSize' ,
8887 ) ;
8988 }
9089
@@ -247,7 +246,6 @@ class OnyxCache {
247246 const iterator = this . recentKeys . values ( ) ;
248247 const safeKeysToRemove : OnyxKey [ ] = [ ] ;
249248
250- // First pass: identify safe keys to evict that aren't the most recently added key
251249 const recentKeysArray = Array . from ( this . recentKeys ) ;
252250 const mostRecentKey = recentKeysArray [ recentKeysArray . length - 1 ] ;
253251
@@ -262,12 +260,7 @@ class OnyxCache {
262260 iterResult = iterator . next ( ) ;
263261 }
264262
265- // Even if we don't have enough safe keys to evict, remove all available safe keys
266- // This will get us as close as possible to the target size without removing the most recent key
267- const keysToRemove = safeKeysToRemove ;
268-
269- // Remove the identified keys from cache
270- keysToRemove . forEach ( ( key ) => {
263+ safeKeysToRemove . forEach ( ( key ) => {
271264 delete this . storageMap [ key ] ;
272265 this . recentKeys . delete ( key ) ;
273266 } ) ;
@@ -364,11 +357,6 @@ class OnyxCache {
364357 getKeyForEviction ( ) : OnyxKey | undefined {
365358 return this . recentlyAccessedKeys . find ( ( key ) => ! this . evictionBlocklist [ key ] ) ;
366359 }
367-
368- /** Get the size of the recentKeys set */
369- getRecentKeysSize ( ) : number {
370- return this . recentKeys . size ;
371- }
372360}
373361
374362const instance = new OnyxCache ( ) ;
0 commit comments