public void purgeCache ( ) { synchronized ( users ) { users . values ( ) . stream ( ) . map ( Reference :: get ) . filter ( Objects :: nonNull ) . map ( Cleanupable . class :: cast ) . forEach ( Cleanupable :: cleanup ) ; users . clear ( ) ; } userIdByRef . clear ( ) ; servers . values ( ) . stream ( ) . map ( Cleanupable . class :: cast ) . forEach ( Cleanupable :: cleanup ) ; servers . clear ( ) ; channels . values ( ) . stream ( ) . filter ( Cleanupable . class :: isInstance ) . map ( Cleanupable . class :: cast ) . forEach ( Cleanupable :: cleanup ) ; channels . clear ( ) ; unavailableServers . clear ( ) ; customEmojis . clear ( ) ; messages . clear ( ) ; messageIdByRef . clear ( ) ; timeOffset = null ; }
Purges all cached entities . This method is only meant to be called after receiving a READY packet .