Reading Buses API V3.0.0
A C#, .net Standard Library for the Reading Buses Open Data API (https://reading-opendata.r2p.com/), available to use in your C# console, WPF, UWP or Win Form Applications.
ReadingBusesAPI.Common.CacheWriter Class Reference

Used to write a cache files to the disk. More...

Static Public Member Functions

static async Task< T > ReadOrCreateCache< T > (string cacheLocation, string liveURL, bool useCache)
 Checks is the data stored within cache, if so read it, else make a request to the live API and cache this result for next time. More...
 
static void CreateCacheDirectory ()
 Creates the two hidden cache folders. More...
 
static string TrackingHistory (BusService service, BusStop location, DateTime date, string vehicle)
 The file name for a tracking history cache file. More...
 
static string TimetabledJourneys (BusService service, BusStop location, DateTime date)
 The file name for a Timetabled Journey cache file. More...
 

Static Public Attributes

static readonly string CACHE_FOLDER = "cache"
 
static readonly string ARCHIVED_CACHE_FOLDER = "cache-archive"
 

Static Package Functions

static string VehiclePositionHistory (DateTime dateStartTime, TimeSpan timeSpan, string vehicle)
 The file name for a the vehicle position history cache file. More...
 

Detailed Description

Used to write a cache files to the disk.

Member Function Documentation

◆ CreateCacheDirectory()

static void ReadingBusesAPI.Common.CacheWriter.CreateCacheDirectory ( )
static

Creates the two hidden cache folders.

◆ ReadOrCreateCache< T >()

static async Task< T > ReadingBusesAPI.Common.CacheWriter.ReadOrCreateCache< T > ( string  cacheLocation,
string  liveURL,
bool  useCache 
)
static

Checks is the data stored within cache, if so read it, else make a request to the live API and cache this result for next time.

Template Parameters
TThe type of data we are wanting.
Parameters
cacheLocationThe location of cache on disk if it exists.
liveURLThe live url to find the data within the API.
useCacheStates if we should check and use cache or not.
Returns

◆ TimetabledJourneys()

static string ReadingBusesAPI.Common.CacheWriter.TimetabledJourneys ( BusService  service,
BusStop  location,
DateTime  date 
)
static

The file name for a Timetabled Journey cache file.

Parameters
serviceThe bus service/
locationThe bus stop
dateThe date of the request.
Returns
The cache location.

◆ TrackingHistory()

static string ReadingBusesAPI.Common.CacheWriter.TrackingHistory ( BusService  service,
BusStop  location,
DateTime  date,
string  vehicle 
)
static

The file name for a tracking history cache file.

Parameters
serviceThe bus service/
locationThe bus stop
dateThe date of the request.
vehicleThe vehicle id
Returns
The cache location.

◆ VehiclePositionHistory()

static string ReadingBusesAPI.Common.CacheWriter.VehiclePositionHistory ( DateTime  dateStartTime,
TimeSpan  timeSpan,
string  vehicle 
)
staticpackage

The file name for a the vehicle position history cache file.

Parameters
dateStartTimeThe date of interest
timeSpanThe time length of interest.
vehicleThe vehicle id.
Returns
The cache location.

Member Data Documentation

◆ ARCHIVED_CACHE_FOLDER

readonly string ReadingBusesAPI.Common.CacheWriter.ARCHIVED_CACHE_FOLDER = "cache-archive"
static

◆ CACHE_FOLDER

readonly string ReadingBusesAPI.Common.CacheWriter.CACHE_FOLDER = "cache"
static

The documentation for this class was generated from the following file: