public Station[] getAllStations() { ProxyCache <Station[]> proxyCache = new ProxyCache <Station[]>(); Station[] stations = proxyCache.Get(stationsKey); if (stations == null || stations.Length == 0) { ListStationsApi client = new ListStationsApi(); proxyCache.Set(stationsKey, client.GetStations()); stations = proxyCache.Get(stationsKey); } return(stations); }
public Station getStation(string number, string name) { String key = name + "/" + number; ProxyCache <Station> proxyCache = new ProxyCache <Station>(); Station s = proxyCache.Get(key); if (s == null) { StationApi client = new StationApi(number, name); proxyCache.Set(key, client.GetStation(), 60); s = proxyCache.Get(key); } return(s); }
public Station GetStation(string id_contract) { ctx.OutgoingResponse.Headers.Add("Access-Control-Allow-Origin", "*"); ctx.OutgoingResponse.Headers.Add("Access-Control-Allow-Methods", "GET, PUT, POST, DELETE, HEAD, OPTIONS"); return(cache.Get(id_contract, 30).getStation()); }