Rework caching
This does a *lot* of things. Essentially, it replaces the existing individual proxy- and autoproxy caches on the bot end with a global cache (in Core) that handles all the caching at once, and automatically invalidates the cache once something changes in the datastore. This allows us to do proxying and autoproxying with *zero database queries* (best-case).
This commit is contained in:
@@ -3,8 +3,11 @@ using System;
|
||||
using App.Metrics;
|
||||
|
||||
using Autofac;
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
using NodaTime;
|
||||
|
||||
@@ -23,6 +26,9 @@ namespace PluralKit.Core
|
||||
builder.RegisterType<DbConnectionFactory>().AsSelf().SingleInstance();
|
||||
builder.RegisterType<PostgresDataStore>().AsSelf().As<IDataStore>();
|
||||
builder.RegisterType<SchemaService>().AsSelf();
|
||||
|
||||
builder.Populate(new ServiceCollection().AddMemoryCache());
|
||||
builder.RegisterType<ProxyCache>().AsSelf().SingleInstance();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user