public void SetUserPhoto(int tenant, Guid id, byte[] photo) { Service.SetUserPhoto(tenant, id, photo); CacheUserPhotoItem.Publish(new UserPhotoCacheItem { Key = UserServiceCache.GetUserPhotoCacheKey(tenant, id) }, CacheNotifyAction.Remove); }
public byte[] GetUserPhoto(int tenant, Guid id) { var photo = Cache.Get <byte[]>(UserServiceCache.GetUserPhotoCacheKey(tenant, id)); if (photo == null) { photo = Service.GetUserPhoto(tenant, id); Cache.Insert(UserServiceCache.GetUserPhotoCacheKey(tenant, id), photo, PhotoExpiration); } return(photo); }