public Data get ( Key key ) { synchronized ( cache ) { Pair < Data , Long > p = cache . get ( key ) ; if ( p != null ) { p . setValue2 ( Long . valueOf ( System . currentTimeMillis ( ) ) ) ; return p . getValue1 ( ) ; } p = new Pair <> ( provider . provide ( key ) , Long . valueOf ( System . currentTimeMillis ( ) ) ) ; cache . put ( key , p ) ; return p . getValue1 ( ) ; } }
Get a data or create it using the provider .