mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-14 18:37:28 -06:00
[performance] cache recently allowed/denied domains to cut down on db calls (#794)
* fetch creation and fetching domain blocks from db Signed-off-by: kim <grufwub@gmail.com> * add separate domainblock cache type, handle removing block from cache on delete Signed-off-by: kim <grufwub@gmail.com> * fix sentinel nil values being passed into cache Signed-off-by: kim <grufwub@gmail.com> Signed-off-by: kim <grufwub@gmail.com>
This commit is contained in:
parent
bf9d146987
commit
d68c04a6c0
7 changed files with 245 additions and 41 deletions
|
|
@ -21,10 +21,21 @@ package db
|
|||
import (
|
||||
"context"
|
||||
"net/url"
|
||||
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||
)
|
||||
|
||||
// Domain contains DB functions related to domains and domain blocks.
|
||||
type Domain interface {
|
||||
// CreateDomainBlock ...
|
||||
CreateDomainBlock(ctx context.Context, block gtsmodel.DomainBlock) Error
|
||||
|
||||
// GetDomainBlock ...
|
||||
GetDomainBlock(ctx context.Context, domain string) (*gtsmodel.DomainBlock, Error)
|
||||
|
||||
// DeleteDomainBlock ...
|
||||
DeleteDomainBlock(ctx context.Context, domain string) Error
|
||||
|
||||
// IsDomainBlocked checks if an instance-level domain block exists for the given domain string (eg., `example.org`).
|
||||
IsDomainBlocked(ctx context.Context, domain string) (bool, Error)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue