Тёмный

How to effectively use Redis Cache in .NET Core (Framework, Standard) 

Nick Chapsas
Подписаться 295 тыс.
Просмотров 96 тыс.
50% 1

Become a Patreon and get source code access: / nickchapsas
Check out my courses: dometrain.com
Hello everybody I'm Nick and in this .NET tutorial I will show you how you can use Redis in your .NET applications the correct way. I will talk about key value pair storage but also the pub/sub aspect of Redis. We will have a subscriber for our Redis cluster and we will publish messages and see them consumed in real time. We will also enable master-replica replication and see how Redis deals with this scenario.
Redis desktop manager: redisdesktop.com/
Don't forget to comment, like and subscribe :)
Social Media:
Follow me on GitHub: bit.ly/ChapsasGitHub
Follow me on Twitter: bit.ly/ChapsasTwitter
Connect on LinkedIn: bit.ly/ChapsasLinkedIn
#dotnet #redis #cache

Опубликовано:

 

4 фев 2020

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 64   
@MarcusOrciuch
@MarcusOrciuch 4 года назад
One of the most underrated tutorial channels on RU-vid. Keep it up!
@calinmarian2553
@calinmarian2553 2 года назад
Good tutorial, Nick. Used this pub/sub feature in one of the projects to comunicate between admin part an the public website, very simple and elegant solution.
@partialinfinity
@partialinfinity 4 года назад
Great video! I like how you explained each step and incorporated Docker.
@swenmeinert3967
@swenmeinert3967 3 года назад
Perfect explanation. Should be model to every attempt out there.
@ades3967
@ades3967 4 года назад
You're the best man! Best tutorials on RU-vid
@ismailkhouya2923
@ismailkhouya2923 2 года назад
Thanks a lot , your explanation is literally perfect
@wowDepressive
@wowDepressive 4 года назад
this was really helpful and quick, thanks.
@SanjayKumar-tw6sp
@SanjayKumar-tw6sp 3 года назад
Appropriated Nice One!!! . I am expecting advance video on this topic.
@noblenetdk
@noblenetdk 3 года назад
I know it's not relevant, but I love the sound of your keyboard - what make/model? Keep Youtubing! This is clearly my favorite channel to keep up and to be inspired
@RandallEike
@RandallEike 2 года назад
Best Redis video ever!
@MatthewKrieger
@MatthewKrieger 3 года назад
@Nick Do you have a recommendation for a standard pattern for grabbing data from the database if the cache isn't populated, and then for updating the cache?
@JAYLATHIA
@JAYLATHIA 2 года назад
Very well explained... Lovely
@GovernorSilver
@GovernorSilver 3 года назад
Hi, I subscribed to your mailing list but still could not find the source code that was used in the video. Also, if I wanted to start from scratch, would it be to just do a dotnet new console on the command line?
@maartenvissers283
@maartenvissers283 3 года назад
How would you implement this in a Clean Architecture structure? (MediatR, Query, Commands).
@Zhovten
@Zhovten 4 года назад
does subscriber work in oneMessage-to-oneSubscriber mode or one-to-many (assuming I run a cluster of web apps)?
@GovernorSilver
@GovernorSilver 3 года назад
I can't get your example to build because Visual Studio cannot find that class NewCacheEntryRequest that you used in your CacheController. Is there any particular reason you had to use that request class instead of just passing in a key and value?
@johnlovell8299
@johnlovell8299 2 года назад
Now I remember why I stopped writing .net apps :) Great tutorial tho!
@native-nature-video
@native-nature-video 10 месяцев назад
Thank you!
@entityhomecinema
@entityhomecinema 3 года назад
Can one configure maxmemory-policy through StackExchange Redis?
@shuvo9131
@shuvo9131 3 года назад
nice one. thanks.
@dfytq
@dfytq 2 года назад
Is there any way to perform query on stored data using .NET ?
@aravindpk9736
@aravindpk9736 Год назад
Hi Nick, so what is the difference between using this StackExchange.Redis nuget directly vs using using Microsoft.Extensions.Caching.Distributed, and using it there..?
@Zhovten
@Zhovten 4 года назад
should I use Microsoft.Extensions.Caching.StackExchangeRedis or StackExchange.Redis
@saeedsedigh443
@saeedsedigh443 2 года назад
Thank u so much!
@ismailbenjemra7240
@ismailbenjemra7240 Год назад
Hello that's good content,can you please make an example for a Redis with certificate connection and Login and Password ?
@clashclan4739
@clashclan4739 2 года назад
Serialization and deserialization make redis slow, it beats the purpose. do you have any improvements?
@mohamedsalman3205
@mohamedsalman3205 3 года назад
Thank you
@ayushgupta9892
@ayushgupta9892 4 года назад
Hi, what happens when I have 500 parallel requests trying to write data to cache, I want to allow only one request to write data to cache and rest 499 request to read data, considering there are multiple web servers running. Something like avoiding multiple same updates on a key and improving the efficiency
@Karma-rq9vn
@Karma-rq9vn 3 года назад
You can't, however you can use different Redis "commands" like set if not exists or set if exists, and for example incrementing a value is atomic, so if you increment a value, from different sources, all of them will be applied.
@kolesplace
@kolesplace 3 года назад
Thanks Nick. I'm curious how others would handle per-user settings.
@nickchapsas
@nickchapsas 3 года назад
On a per-users scenario you have to bake the user identifier into the redis key
@kolesplace
@kolesplace 3 года назад
@@nickchapsas Excellent, that is what I was thinking but wasn't sure if my thinking was in-line with the best practice. Thank you for replying.
@OvRaf
@OvRaf 4 года назад
great!
@knightmarerip711
@knightmarerip711 4 года назад
Coll stuff, but... How do I define servers with different passwords? How do I set this up in the start up?
@nickchapsas
@nickchapsas 4 года назад
The connection string allows for that. You can check all the allowed settings here: stackexchange.github.io/StackExchange.Redis/Configuration.html
@othonh1
@othonh1 3 года назад
Nice vid! I only hope that your chapsa is not too big. :P
@kevinmarkandrada
@kevinmarkandrada 4 года назад
Hi @nick! Great video again! I just wanna ask what will happen if the master fails or crash. Does the slave automatically took place in writing the cache? Thanks and Godless! Hoping for another video that will be covered the rabbitmq or kafkha.
@nickchapsas
@nickchapsas 4 года назад
In case of disaster on the master the Redis Sentinel will trigger an automatic failover and the replica will take over. You can also trigger that process manually.
@kevinmarkandrada
@kevinmarkandrada 4 года назад
@@nickchapsas Is there any configuration of redis sentinel or it's on the fly?
@nonatw7956
@nonatw7956 4 года назад
hey nick can you add elastichsearch and CI/CD video ?
@nickchapsas
@nickchapsas 4 года назад
Elastic search is coming really soon and I am planning to do cover a few CI and cd videos too
@acp3012
@acp3012 2 года назад
I am getting the below error when i try redis cache. I ran docker on my local linux m/c and did the same demo. Here is the error message i got when i kit the Post method to store data in reids db. Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1] An unhandled exception has occurred while executing the request. StackExchange.Redis.RedisTimeoutException: The timeout was reached before the message could be written to the output buffer, and it was not sent I search in google and added some other optional values to the redis connection string as below localhost:6379,abortConnect=false,connectTimeout=30000,responseTimeout=30000". but the problem not resolved.
@acp3012
@acp3012 2 года назад
Never mind. Looks like it is port issue, When i mapped the map 6379 to another port (-p6070:6379), it works fine. Thanks for the nice video
@koorshashirazi2037
@koorshashirazi2037 4 года назад
👌👌👌
@Geoters
@Geoters 4 года назад
Sorry, you failed to mention is why would we want to have a replica? What is the benefit? Does it allow me to bring the master computer down for maintenance? And if it does, my replica becomes a master in this case?
@oktaysezgin8277
@oktaysezgin8277 4 года назад
hi Nick, thanks a lot for the videos. However, I cannot find the source code for this video in your github repos. Oktay
@nickchapsas
@nickchapsas 4 года назад
Oh my god sorry for that. I forgot to push the commit. It should be up now.
@oktaysezgin8277
@oktaysezgin8277 4 года назад
no worries.. thanks a lot..
@oktaysezgin8277
@oktaysezgin8277 4 года назад
no worries... thanks a lot
@lauriedickinson5373
@lauriedickinson5373 4 года назад
I can't find it either. What repo is it in? Also, yes, great video. Thanks!
@clearlyunwell
@clearlyunwell 3 года назад
👍🏽
@ibknl1986
@ibknl1986 2 года назад
A very wonderful channel. Thank you for making these videos and helping us. May Allah ( God) guide and bless you and.
@Will_Huang
@Will_Huang 4 года назад
Get the source code: eepurl.com/gLjkuv The link is wrong.
@dzsukov
@dzsukov 4 года назад
Great Tutorial! Thanks. One question I seem to be unable to find, has anyone figured out how to retrieve a list of values based on keys with wildcards ? In "Native" redis: SET user:1 "Nick"; SET user:2 "Daniel" and then KEYS user:* withh give me the result. Another option is Scan with pattern matching which I also could not find in this package
@Karma-rq9vn
@Karma-rq9vn 3 года назад
If you want a list of values, maybe you can use the Hash data type, or a hash of the Redis Keys, you want to retrieve.
@rubeushagrid4131
@rubeushagrid4131 2 года назад
Not everyone reach upto here.
@advanceduser3713
@advanceduser3713 Год назад
Speak too fast.. :(
Далее
Why .NET's memory cache is kinda flawed
14:13
Просмотров 55 тыс.
skibidi toilet 76 (full episode)
08:11
Просмотров 11 млн
Копия iPhone с WildBerries
01:00
Просмотров 368 тыс.
Intro to Redis in C# - Caching Made Easy
1:27:29
Просмотров 174 тыс.
Redis Crash Course
27:31
Просмотров 607 тыс.
The Best Advice from a 20-Year Programming Veteran
11:00
I've been using Redis wrong this whole time...
20:53
Просмотров 340 тыс.
What Is .NET Aspire? The Insane Future of .NET!
18:35
Просмотров 264 тыс.
What is Span in C# and why you should be using it
15:15
skibidi toilet 76 (full episode)
08:11
Просмотров 11 млн