// ĠCopyright Ġ 2 0 0 0 - 2 0 1 8 ĠJetBrains Ġs . r . o . ĠUse Ġof Ġthis Ġsource Ġcode Ġis Ġgoverned Ġby Ġthe ĠApache Ġ 2 . 0 Ġlicense Ġthat Ġcan Ġbe Ġfound Ġin Ġthe ĠLICENSE Ġfile . Ċ package Ġcom . jetbrains . python . code Insight . typing Ċ Ċ import Ġcom . google . common . cache . Cache Ċ import Ġcom . google . common . cache . Cache Builder Ċ import Ġcom . google . common . cache . Cache Loader Ċ import Ġcom . intellij . openapi . application . Application Manager Ċ import Ġcom . intellij . openapi . project Roots . Sdk Ċ import Ġcom . intellij . web core . packaging . Repo Package Ċ import Ġcom . jetbrains . python . packaging . Py PackageManager Ċ import Ġjava . time . Duration Ċ Ċ class ĠPy Stub Packages Ad vert iser Cache Ġ{ ĊĊĠ Ġprivate Ġval Ġcache Ġ= ĠCache Builder . newBuilder () ĊĠĠĠ Ġ. maximum Size ( 3 ) ĊĠĠĠ Ġ. expire After Access ( Duration . of Minutes ( 1 0 )) ĊĠĠĠ Ġ. build < Sdk , ĠCache < String , ĠSet < Repo Package >> >( ĊĠĠĠĠĠ ĠCache Loader . from Ġ{ Ġ_ Ġ-> ĊĠĠĠĠĠĠĠ ĠCache Builder . newBuilder () ĊĠĠĠĠĠĠĠĠĠ Ġ. maximum Size ( 5 0 ) ĊĠĠĠĠĠĠĠĠĠ Ġ. expire After Access ( Duration . of Minutes ( 5 )) ĊĠĠĠĠĠĠĠĠĠ Ġ. build < String , ĠSet < Repo Package >>() ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ) ĊĊĠ Ġinit Ġ{ ĊĠĠĠ Ġval Ġconnection Ġ= ĠApplication Manager . getApplication (). message Bus . connect () ĊĠĠĠ Ġconnection . subscribe ( Py PackageManager . PACKAGE _ MANAGER _ TOPIC , ĠPy PackageManager . Listener Ġ{ Ġcache . invalidate ( it ) Ġ}) ĊĠ Ġ} ĊĊĠ Ġfun Ġfor Sdk ( sdk : ĠS dk ): ĠCache < String , ĠSet < Repo Package >> Ġ{ ĊĠĠĠ Ġreturn Ġcache . get ( sdk ) ĊĠ Ġ} Ċ }