public async Task AddPhotoToCachesAsync(IPhotoModel photo) { //Add to list of all user photos await RedisCache.ListLeftPushAsync <IPhotoModel>(_cache, RedisConfig.AllUsersCache, photo); //Add to list of user-specific photos await RedisCache.ListLeftPushAsync <IPhotoModel>(_cache, RedisConfig.PhotosForUserCache(photo.Owner), photo); //Add single item to cache await RedisCache.SetAsync <IPhotoModel>(_cache, RedisConfig.PhotoByIDCache(photo.ID), photo); }
public async Task ClearCacheItemAsync(string id) { await RedisCache.ClearCacheForKeyAsync(_cache, RedisConfig.PhotoByIDCache(id)); }
public async Task ClearUserCacheAsync(string user) { await RedisCache.ClearCacheForKeyAsync(_cache, RedisConfig.PhotosForUserCache(user)); }
public async Task AddPhotoToUserCacheAsync(IPhotoModel photo) { //Add to list of user-specific photos await RedisCache.ListLeftPushAsync <IPhotoModel>(_cache, RedisConfig.PhotosForUserCache(photo.Owner), photo); }
public async Task <IPhotoModel> GetPhotoByIDAsync(string id) { return(await RedisCache.GetAsync <IPhotoModel>(_cache, RedisConfig.PhotoByIDCache(id))); }
public async Task <IEnumerable <IPhotoModel> > GetPhotosForUserAsync(string user) { return(await RedisCache.ListRangeAsync <IPhotoModel>(_cache, RedisConfig.PhotosForUserCache(user))); }