Caching
Fast, consistent caching with InMemory, Redis, and Hybrid implementations. Includes scoped cache support.
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()
);
var testLock = await locker.AcquireAsync("test");
// ... do work
await testLock.ReleaseAsync();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");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 |
|---|---|---|---|---|---|
| In-Memory | ✅ | ✅ | ✅ | ✅ | ✅ |
| Redis | ✅ | ✅ | ✅ | ✅ | ✅ |
| Azure Storage | ✅ | ✅ | |||
| Azure ServiceBus | ✅ | ✅ | |||
| AWS | ✅ | ✅ | |||
| Kafka | ✅ | ||||
| RabbitMQ | ✅ | ||||
| Minio | ✅ | ||||
| Aliyun | ✅ | ||||
| SshNet | ✅ |