Posts

Showing posts from 2021

Distributed Redis Caching In ASP.NET Core

Image
Download source code from GitHub   Table of Content What is distributed caching and its benefit IDistributedCache interface Framework provided to implement Distributed Redis cache Setting up Redis on Windows 10 Redis CLI commands Steps to integrate Redis cache in ASP.NET core Summary What is distributed caching and its benefit   Distributed caching is when you want to handle caching outside of your application. This also can be shared by one or more applications/servers. Distributed cache is application-specific; i.e., multiple cache providers support distributed caches. To implement distributed cache, we can use Redis and NCache. We will see about Redis cache in detail.   A distributed cache can improve the performance and scalability of an ASP.NET Core app, especially when the app is hosted by a cloud service or a server farm.   Benefits Data is consistent throughout multiple servers. This is more suitable for microservice architecture In case of loading balancing,...

How to get different date formats in SQL Server

Image
  How to get different date formats in SQL Server Use the SELECT statement with CONVERT function and date format option for the date values needed To get YYYY-MM-DD use this T-SQL syntax SELECT CONVERT(varchar, getdate(), 23) To get MM/DD/YY use this T-SQL syntax SELECT CONVERT(varchar, getdate(), 1) Check out the chart to get a list of all format options Below is a list of SQL date formats and an example of the output.  The date used for all of these examples is "2006-12-30 00:38:54.840". DATE ONLY FORMATS Format # Query Format Sample 1 select convert(varchar, getdate(), 1) mm/dd/yy 12/30/06 2 select convert(varchar, getdate(), 2) yy.mm.dd 06.12.30 3 select convert(varchar, getdate(), 3) dd/mm/yy 30/12/06 4 select convert(varchar, getdate(), 4) dd.mm.yy 30.12.06 5 select convert(varchar, getdate(), 5) dd-mm-yy 30-12-06 6 select convert(varchar, getdate(), 6) dd-Mon-yy 30 Dec 06 7 select convert(varchar, getdate(), 7) Mon dd, yy Dec 30, 06 10 select convert(varchar, getdate()...