Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }