Bhatti WebTechnology With .NET Unit-3
Bhatti WebTechnology With .NET Unit-3
with .NET
Cache in computing
Cache in computing
Cache in computing
lIMemoryCache
lIDistributedCache
Cache guidelines
Cache guidelines
Caching
Why caching???
Limitations of Caching???
Caching Data
Example – CacheData1
lbuilder.Services.AddMemoryCache();
Example – CacheData1
lusing
Microsoft.Extensions.Caching.Memory;
Example – CacheData1
Example – CacheData1
Example – CacheData1
IDistributedCache Methods
DistributedCacheEntryOptions
lAbsoluteExpiration
DistributedCacheEntryOptions
lAbsoluteExpirationRelativeToNow
DistributedCacheEntryOptions
lSlidingExpiration
MemoryCacheOptions Properties
MemoryCacheOptions Properties
lbuilder.Services.AddDistributedMemoryCa
che(opts => { opts.SizeLimit = 200; });
AddDistributedSqlServerCache
lsqlcmd -S "(localdb)\MSSQLLocalDB"
AddDistributedSqlServerCache
AddDistributedSqlServerCache
AddDistributedSqlServerCache
AddDistributedSqlServerCache
AddDistributedSqlServerCache
SqlServerCacheOptions Properties
Caching Responses
lAdvantages
¡It speeds up development time for teams.
¡Decreases the cost of development.
¡Handles the logic required to interact with
databases.
¡Improves security. ORM tools are built to
eliminate the possibility of SQL injection
attacks.
¡You write less code when using ORM tools than
with SQL.
Prof. (Dr.) Dharmendra Bhatti 54
lLimitations
¡Learning how to use ORM tools can be time
consuming.
¡They are likely not going to perform better when
very complex queries are involved.
¡ORMs are generally slower than using SQL.
Approach
Approach
Approach
Approach
lApplying a Migration
¡dotnet ef database update
WebApp Example
WebApp Example
WebApp Example
WebApp Example
lapp.UseMiddleware<WebApp.TestMiddl
eware>();
Questions ???