Using IMemoryCache to cache data in-memory using .NET 5 [An Introduction]

In this video, I am going to walk through how to cache data in-memory using the IMemoryCache interface in .NET 5.

Caching is a very useful mechanism to easily increase the performance of any application.

Previously I have covered topics on distributed cache services.

An introduction to Memcached, a distributed caching server: https://youtu.be/yQ8Kwx9M_Hg

An introduction to Redis, a distributed caching server: https://youtu.be/qYBaMFHeom8

  • 00:05 - Introduction of what is caching
  • 02:45 - Explain the problem domain
  • 03:34 - Create a new class for implementing cache using IMemoryCache
  • 04:55 - Get an item from the cache using a key
  • 05:50 - Add item to the cache
  • 06:50 - Different overloads for adding cache
  • 07:15 - Elaborate MemoryCacheEntryOptions object
  • 07:35 - Explaining cache expiration and difference between sliding and absolute expiration policy
  • 09:20 - Explanation of how to avoid stale data forever when using sliding expiration
  • 10:15 - What is a post-eviction callback and how it can be useful
  • 11:00 - Cache priority
  • 11:15 - Size of the cache entry
  • 11:50 - Mechanism I follow to add items to the cache using TryGetValue method
  • 13:40 - Configuring dependency injection for IMemoryCache
  • 14:05 - Explaining the overloads for AddMemoryCache extension method for adding IMemoryCache to the dependency injection
  • 15:00 - explaining CompactionPercentage property
  • 16:05 - Update the API to use the cache provider to get data
  • 17:05 - Debug through the code and explain how the feature is working

#dotnet #developer

What is GEEK

Buddha Community

Using IMemoryCache to cache data in-memory using .NET 5 [An Introduction]
Einar  Hintz

Einar Hintz

1602560783

jQuery Ajax CRUD in ASP.NET Core MVC with Modal Popup

In this article, we’ll discuss how to use jQuery Ajax for ASP.NET Core MVC CRUD Operations using Bootstrap Modal. With jQuery Ajax, we can make HTTP request to controller action methods without reloading the entire page, like a single page application.

To demonstrate CRUD operations – insert, update, delete and retrieve, the project will be dealing with details of a normal bank transaction. GitHub repository for this demo project : https://bit.ly/33KTJAu.

Sub-topics discussed :

  • Form design for insert and update operation.
  • Display forms in modal popup dialog.
  • Form post using jQuery Ajax.
  • Implement MVC CRUD operations with jQuery Ajax.
  • Loading spinner in .NET Core MVC.
  • Prevent direct access to MVC action method.

Create ASP.NET Core MVC Project

In Visual Studio 2019, Go to File > New > Project (Ctrl + Shift + N).

From new project window, Select Asp.Net Core Web Application_._

Image showing how to create ASP.NET Core Web API project in Visual Studio.

Once you provide the project name and location. Select Web Application(Model-View-Controller) and uncheck HTTPS Configuration. Above steps will create a brand new ASP.NET Core MVC project.

Showing project template selection for .NET Core MVC.

Setup a Database

Let’s create a database for this application using Entity Framework Core. For that we’ve to install corresponding NuGet Packages. Right click on project from solution explorer, select Manage NuGet Packages_,_ From browse tab, install following 3 packages.

Showing list of NuGet Packages for Entity Framework Core

Now let’s define DB model class file – /Models/TransactionModel.cs.

public class TransactionModel
{
    [Key]
    public int TransactionId { get; set; }

    [Column(TypeName ="nvarchar(12)")]
    [DisplayName("Account Number")]
    [Required(ErrorMessage ="This Field is required.")]
    [MaxLength(12,ErrorMessage ="Maximum 12 characters only")]
    public string AccountNumber { get; set; }

    [Column(TypeName ="nvarchar(100)")]
    [DisplayName("Beneficiary Name")]
    [Required(ErrorMessage = "This Field is required.")]
    public string BeneficiaryName { get; set; }

    [Column(TypeName ="nvarchar(100)")]
    [DisplayName("Bank Name")]
    [Required(ErrorMessage = "This Field is required.")]
    public string BankName { get; set; }

    [Column(TypeName ="nvarchar(11)")]
    [DisplayName("SWIFT Code")]
    [Required(ErrorMessage = "This Field is required.")]
    [MaxLength(11)]
    public string SWIFTCode { get; set; }

    [DisplayName("Amount")]
    [Required(ErrorMessage = "This Field is required.")]
    public int Amount { get; set; }

    [DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
    public DateTime Date { get; set; }
}

C#Copy

Here we’ve defined model properties for the transaction with proper validation. Now let’s define  DbContextclass for EF Core.

#asp.net core article #asp.net core #add loading spinner in asp.net core #asp.net core crud without reloading #asp.net core jquery ajax form #asp.net core modal dialog #asp.net core mvc crud using jquery ajax #asp.net core mvc with jquery and ajax #asp.net core popup window #bootstrap modal popup in asp.net core mvc. bootstrap modal popup in asp.net core #delete and viewall in asp.net core #jquery ajax - insert #jquery ajax form post #modal popup dialog in asp.net core #no direct access action method #update #validation in modal popup

 iOS App Dev

iOS App Dev

1620466520

Your Data Architecture: Simple Best Practices for Your Data Strategy

If you accumulate data on which you base your decision-making as an organization, you should probably think about your data architecture and possible best practices.

If you accumulate data on which you base your decision-making as an organization, you most probably need to think about your data architecture and consider possible best practices. Gaining a competitive edge, remaining customer-centric to the greatest extent possible, and streamlining processes to get on-the-button outcomes can all be traced back to an organization’s capacity to build a future-ready data architecture.

In what follows, we offer a short overview of the overarching capabilities of data architecture. These include user-centricity, elasticity, robustness, and the capacity to ensure the seamless flow of data at all times. Added to these are automation enablement, plus security and data governance considerations. These points from our checklist for what we perceive to be an anticipatory analytics ecosystem.

#big data #data science #big data analytics #data analysis #data architecture #data transformation #data platform #data strategy #cloud data platform #data acquisition

Gerhard  Brink

Gerhard Brink

1620629020

Getting Started With Data Lakes

Frameworks for Efficient Enterprise Analytics

The opportunities big data offers also come with very real challenges that many organizations are facing today. Often, it’s finding the most cost-effective, scalable way to store and process boundless volumes of data in multiple formats that come from a growing number of sources. Then organizations need the analytical capabilities and flexibility to turn this data into insights that can meet their specific business objectives.

This Refcard dives into how a data lake helps tackle these challenges at both ends — from its enhanced architecture that’s designed for efficient data ingestion, storage, and management to its advanced analytics functionality and performance flexibility. You’ll also explore key benefits and common use cases.

Introduction

As technology continues to evolve with new data sources, such as IoT sensors and social media churning out large volumes of data, there has never been a better time to discuss the possibilities and challenges of managing such data for varying analytical insights. In this Refcard, we dig deep into how data lakes solve the problem of storing and processing enormous amounts of data. While doing so, we also explore the benefits of data lakes, their use cases, and how they differ from data warehouses (DWHs).


This is a preview of the Getting Started With Data Lakes Refcard. To read the entire Refcard, please download the PDF from the link above.

#big data #data analytics #data analysis #business analytics #data warehouse #data storage #data lake #data lake architecture #data lake governance #data lake management

Cyrus  Kreiger

Cyrus Kreiger

1617731760

An Introduction to Data Connectors: Your First Step to Data Analytics

Modern analytics teams are hungry for data. They are generating incredible insights that make their organizations smarter and are emphasizing the need for data-driven decision making across the board. However, data comes in many shapes and forms and is often siloed away. What actually makes the work of analytics teams possible is the aggregation of data from a variety of sources into a single location where it is easy to query and transform. And, of course, this data needs to be accurate and up-to-date at all times.

Let’s take an example. Maybe you’re trying to understand how COVID-19 is impacting your churn rates, so you can plan your sales and marketing spends appropriately in 2021. For this, you need to extract and combine data from a few different sources:

  • MySQL database that details all the interactions your users are having with your product
  • Salesforce account that contains the latest information about your current and prospective customers
  • Zendesk account that has all support tickets raised by your customers

#data-analytics #data-science #data-engineering #data #data-warehouse #snowflake #data-connector #machine-learning

Rubalema  Sonia

Rubalema Sonia

1625271420

Create an ASP.NET 5 MVC React Comment Box Application with Server-Side Data

Latest: https://youtu.be/LyVZySzKoI8 (Unit Testing Blazor ASP.NET 5) Previous lecture:
https://youtu.be/1huelbTEqA0

In this lecture I have covered the following topics:
Compose CommentList and CommentForm components
Server-side data
Fetching from the server
Reactive state

This tutorial is based on this article:
https://reactjs.net/tutorials/aspnetcore.html#composing-components

Like || Share || Spread || Love

Make sure you subscribe to our YouTube Channel and never miss our latest video:- http://bit.ly/Kaushik-roy-chowdhury-subscribe

Support The Channel By Donations:
https://www.patreon.com/deveducator

For more updates Follow us on:-

Visit- https://kaushikroychowdhury.com

Facebook- https://www.facebook.com/deveducate

Twitter- https://twitter.com/krchome58

Linkedin- https://www.linkedin.com/in/chowdhurykaushik

Github- https://github.com/krchome

Blogger- https://krchome1.blogspot.com/

Live Journal- https://ext-5537239.livejournal.com/

MIx - https://mix.com/kaushikroychowdhury https://www.skillshare.com/r/profile/Kaushik-Roy-Chowdhury/5724896

#asp.net 5 #.net 5 #asp.net 5 mvc #react #server-side data