@@ -79,26 +79,25 @@ metrics! {
79
79
80
80
#[ derive( Debug , Default ) ]
81
81
pub ( crate ) struct RecentlyAccessedReleases {
82
- krates : DashMap < String , Instant > ,
83
- versions : DashMap < String , Instant > ,
84
- platforms : DashMap < String , Instant > ,
82
+ krates : DashMap < i32 , Instant > ,
83
+ versions : DashMap < i32 , Instant > ,
84
+ platforms : DashMap < ( i32 , String ) , Instant > ,
85
85
}
86
86
87
87
impl RecentlyAccessedReleases {
88
88
pub ( crate ) fn new ( ) -> Self {
89
89
Self :: default ( )
90
90
}
91
91
92
- pub ( crate ) fn record ( & self , krate : & str , version : & str , target : & str ) {
93
- self . krates . insert ( krate. to_owned ( ) , Instant :: now ( ) ) ;
94
- self . versions
95
- . insert ( format ! ( "{}/{}" , krate, version) , Instant :: now ( ) ) ;
92
+ pub ( crate ) fn record ( & self , krate : i32 , version : i32 , target : & str ) {
93
+ self . krates . insert ( krate, Instant :: now ( ) ) ;
94
+ self . versions . insert ( version, Instant :: now ( ) ) ;
96
95
self . platforms
97
- . insert ( format ! ( "{}/{}/{}" , krate , version, target) , Instant :: now ( ) ) ;
96
+ . insert ( ( version, target. to_owned ( ) ) , Instant :: now ( ) ) ;
98
97
}
99
98
100
99
pub ( crate ) fn gather ( & self , metrics : & Metrics ) {
101
- fn inner ( map : & DashMap < String , Instant > , metric : & IntGaugeVec ) {
100
+ fn inner < K : std :: hash :: Hash + Eq > ( map : & DashMap < K , Instant > , metric : & IntGaugeVec ) {
102
101
let mut hour_count = 0 ;
103
102
let mut half_hour_count = 0 ;
104
103
let mut five_minute_count = 0 ;
0 commit comments