Implement key caching directly (#1038)

* Use gomatrixserverlib key caching

* Implement key caching wrapper

* Add caching wrapper in BaseComponent

* Review comments
This commit is contained in:
Neil Alexander 2020-05-15 09:32:40 +01:00 committed by GitHub
parent 7ca230e931
commit 419ff150d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 108 additions and 27 deletions

View file

@ -25,6 +25,7 @@ import (
"github.com/matrix-org/dendrite/common/caching"
"github.com/matrix-org/dendrite/common/keydb"
"github.com/matrix-org/dendrite/common/keydb/cache"
"github.com/matrix-org/dendrite/internal/sqlutil"
"github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/naffka"
@ -186,7 +187,11 @@ func (b *BaseDendrite) CreateKeyDB() keydb.Database {
logrus.WithError(err).Panicf("failed to connect to keys db")
}
return db
cachedDB, err := cache.NewKeyDatabase(db, b.ImmutableCache)
if err != nil {
logrus.WithError(err).Panicf("failed to create key cache wrapper")
}
return cachedDB
}
// CreateFederationClient creates a new federation client. Should only be called