/// <summary> /// Retrieves an object from Redis first, then DocumentCosmosDb afterwards /// </summary> /// <typeparam name="T"></typeparam> /// <param name="id"></param> /// <returns></returns> public T GetObject <T>(string id) { //first try cache T obj = GetObjectOnlyCache <T>(id); if (obj == null) { //now try docdb obj = DocumentCosmosDb.GetDocument <T>(id); } if (obj == null) { return(default(T)); } return(obj); }
/// <summary> /// Retrieves an object from Redis first, then DocumentCosmosDb afterwards /// </summary> /// <typeparam name="T"></typeparam> /// <param name="id"></param> /// <returns></returns> public async Task <T> GetObjectAsync <T>(string id) { //first try cache T obj = await GetObjectOnlyCacheAsync <T>(id); if (obj == null) { //now try docdb obj = DocumentCosmosDb.GetDocument <T>(id); } if (obj == null) { return(default(T)); } return(obj); }