Skip to main content

amandabytes

Tag: Dotnet

Refit

Recently, I had the opportunity to test a great C# library that significantly improves the development of an SDK.

In later experiences develop an sdk project was something really honorous, wee need to create a lot of classes and methods to handle with the api request and response. Then, during my researchs I found Refit.

Refit is an rest library that helps a lot during an sdk develpment, you just need to create the contract classes (if you already has in an side project is even easyer), and create the interfaces for each controller. Simple as that.

An easy way to measure your method performance

Measuring method execution time is essential for optimizing applications, whether for profiling, performance monitoring, or detecting degradation over time. Although there are many tools and libraries available for this purpose, we often seek straightforward and non-intrusive solutions.

# The Solution: MethodTimer

One of the most efficient and cleanest ways to measure method performance in C# is by using the MethodTimer.Fody library. This tool automatically adds timers to the desired methods through a simple attribute, without modifying the existing code.

Implementing Redis Caching with .NET

# Introduction

Recently, I had to implement a cache in an application to avoid unnecessary database queries. Having worked with Redis in the past, I realized that implementing a cache with Redis can be quite straightforward and effective when done correctly.

# Redis vs Memcached

Redis is almost like a NoSQL database but excels as a cache due to its key-value storage model. The choice between Redis and Memcached depends on the use case and data volume. If you need to store session information, Memcached is a good choice. However, for extensive queries involving larger data sets, Redis is more suitable. Memcached uses the application’s memory to store data, while Redis is a distributed cache, independent of the application’s memory, allowing it to scale vertically as demand grows.

Implementing an SQS Publisher and Consumer Using .NET

In a previous post, I introduced the concept of queues and their usage. Now, I will explain how to implement an SQS consumer and publisher using C# and .NET.

# SQS

SQS (Simple Queue Service) is an Amazon Web Services offering that enables the sending, storing, and receiving of messages between software components at any volume, ensuring no message loss and eliminating the need for immediate availability of other services.

Curly braces on new line in vscode

This past week, I dedicated my mornings to a single goal: configuring Visual Studio Code to automatically insert a new line before braces {}.

How it was:

if (true){
  // do something
}

How I wanted it to be:

if (true)
{
  // do something
}

The task proved to be more challenging than I expected. I found many discussions about the same issue in forums and on Stack Overflow, but no definitive solution. So I’m here to share the solution I discovered.