FoundatioBuilding Blocks for Distributed Apps
Pluggable foundation blocks for building loosely coupled distributed applications
| [ Web Proxy ] |
| Viewing: https://foundatio.dev | [Back] [Original] |
Pluggable foundation blocks for building loosely coupled distributed applications
using Foundatio.Caching;
ICacheClient cache = new InMemoryCacheClient();
await cache.SetAsync("test", 1);
var value = await cache.GetAsync<int>("test");using Foundatio.Queues;
IQueue<SimpleWorkItem> queue = new InMemoryQueue<SimpleWorkItem>();
await queue.EnqueueAsync(new SimpleWorkItem { Data = "Hello" });
var workItem = await queue.DequeueAsync();using Foundatio.Lock;
ILockProvider locker = new CacheLockProvider(
new InMemoryCacheClient(),
new InMemoryMessageBus()
);
await using var lck = await locker.AcquireAsync("resource");
if (lck is null)
throw new InvalidOperationException("Could not acquire lock");
// Do exclusive work
await ProcessAsync();using Foundatio.Messaging;
IMessageBus messageBus = new InMemoryMessageBus();
await messageBus.SubscribeAsync<SimpleMessage>(msg => {
// Got message
});
await messageBus.PublishAsync(new SimpleMessage { Data = "Hello" });using Foundatio.Storage;
IFileStorage storage = new InMemoryFileStorage();
await storage.SaveFileAsync("test.txt", "test");
string content = await storage.GetFileContentsAsync("test.txt");using Foundatio.Resilience;
var policy = new ResiliencePolicyBuilder()
.WithMaxAttempts(3)
.WithExponentialDelay(TimeSpan.FromSeconds(1))
.Build();
await policy.ExecuteAsync(async ct => {
await SomeUnreliableOperationAsync(ct);
});When building several large cloud applications we found a lack of great solutions for many key pieces to building scalable distributed applications while keeping the development experience simple. Here's why we built and use Foundatio:
| Provider | Caching | Queues | Messaging | Locks | Storage |
|---|---|---|---|---|---|
| Aliyun | |||||
| AWS | |||||
| Azure ServiceBus | |||||
| Azure Storage | |||||
| In-Memory | |||||
| Kafka | |||||
| Minio | |||||
| RabbitMQ | |||||
| Redis | |||||
| SshNet |
Copyright 2025 Foundatio
| Web Proxy Viewer | New URL | Original Page |