Oddity
|
Represents an cache service used to manage cached data. More...
Public Member Functions | |
CacheService (int lifetimeSeconds) | |
Initializes a new instance of the CacheService<TData> class. More... | |
bool | GetIfAvailable (out TData data, string parameter) |
Checks if there is a cached model with the specified parameter. If yes, then appropriate flag is returned and out parameter is filled. More... | |
bool | GetListIfAvailable (out List< TData > data, string parameter) |
Checks if there is a cached list of models with the specified parameter. If yes, then appropriate flag is returned and out parameter is filled. More... | |
void | Update (TData data, string parameter) |
Updates a model with the specified parameter. More... | |
void | UpdateList (List< TData > data, string parameter) |
Updates a list of models with the specified parameter. More... | |
int | Clear () |
Clears all cached data. More... | |
Properties | |
int | LifetimeSeconds [get, set] |
Gets or sets the number of seconds after which the data should be updated (retrieved from API again). More... | |
Represents an cache service used to manage cached data.
TData | Type of the cached data. |
TData | : | ModelBase | |
TData | : | IIdentifiable |
Oddity.Cache.CacheService< TData >.CacheService | ( | int | lifetimeSeconds | ) |
Initializes a new instance of the CacheService<TData> class.
lifetimeSeconds | The number of seconds after which the data should be updated (retrieved from API again). |
int Oddity.Cache.CacheService< TData >.Clear | ( | ) |
Clears all cached data.
bool Oddity.Cache.CacheService< TData >.GetIfAvailable | ( | out TData | data, |
string | parameter | ||
) |
Checks if there is a cached model with the specified parameter. If yes, then appropriate flag is returned and out parameter is filled.
data | Out parameter which will be used to return cached model (or null if the parameter is new). |
parameter | The parameter used for the identification of the cached model. |
bool Oddity.Cache.CacheService< TData >.GetListIfAvailable | ( | out List< TData > | data, |
string | parameter | ||
) |
Checks if there is a cached list of models with the specified parameter. If yes, then appropriate flag is returned and out parameter is filled.
data | Out parameter which will be used to return cached list of models (or null if the parameter is new). |
parameter | The parameter used for the identification of the cached list of models. |
void Oddity.Cache.CacheService< TData >.Update | ( | TData | data, |
string | parameter | ||
) |
Updates a model with the specified parameter.
data | The model which will be cached. |
parameter | The parameter used for model identification. |
void Oddity.Cache.CacheService< TData >.UpdateList | ( | List< TData > | data, |
string | parameter | ||
) |
Updates a list of models with the specified parameter.
data | The list of models which will be cached. |
parameter | The parameter used for list of models identification. |
|
getset |
Gets or sets the number of seconds after which the data should be updated (retrieved from API again).