cachemem

package
v0.0.0-...-e647751 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(_ context.Context, d db.DB, m metrics.Collector) (db.DB, error)

New creates a new in memory cache.

Types

type CacheMem

type CacheMem struct {
	// contains filtered or unexported fields
}

CacheMem is an in memory caching middleware for our db interface.

func (*CacheMem) Close

func (c *CacheMem) Close(ctx context.Context) db.Error

Close is a pass through.

func (*CacheMem) CountApplicationTokens

func (c *CacheMem) CountApplicationTokens(ctx context.Context) (int64, db.Error)

CountApplicationTokens returns the number of application token.

func (*CacheMem) CountFediAccounts

func (c *CacheMem) CountFediAccounts(ctx context.Context) (int64, db.Error)

CountFediAccounts returns the number of federated social account.

func (*CacheMem) CountFediAccountsForInstance

func (c *CacheMem) CountFediAccountsForInstance(ctx context.Context, instanceID int64) (int64, db.Error)

CountFediAccountsForInstance returns the number of federated social account for an instance.

func (*CacheMem) CountFediInstances

func (c *CacheMem) CountFediInstances(ctx context.Context) (int64, db.Error)

CountFediInstances returns the number of federated instances.

func (*CacheMem) CountOauthClients

func (c *CacheMem) CountOauthClients(ctx context.Context) (int64, db.Error)

CountOauthClients returns the number of oauth clients.

func (*CacheMem) Create

func (c *CacheMem) Create(ctx context.Context, i interface{}) db.Error

Create is a pass through.

func (*CacheMem) CreateApplicationToken

func (c *CacheMem) CreateApplicationToken(ctx context.Context, applicationToken *models.ApplicationToken) db.Error

CreateApplicationToken stores the application token.

func (*CacheMem) CreateFediAccount

func (c *CacheMem) CreateFediAccount(ctx context.Context, account *models.FediAccount) db.Error

CreateFediAccount stores the federated instance and caches it.

func (*CacheMem) CreateFediInstance

func (c *CacheMem) CreateFediInstance(ctx context.Context, instance *models.FediInstance) db.Error

CreateFediInstance stores the federated instance and caches it.

func (*CacheMem) CreateOauthClient

func (c *CacheMem) CreateOauthClient(ctx context.Context, client *models.OauthClient) (err db.Error)

CreateOauthClient stores the oauth client.

func (*CacheMem) DoMigration

func (c *CacheMem) DoMigration(ctx context.Context) db.Error

DoMigration is a pass through.

func (*CacheMem) IncFediAccountLoginCount

func (c *CacheMem) IncFediAccountLoginCount(ctx context.Context, account *models.FediAccount) db.Error

IncFediAccountLoginCount updates the login count of a stored federated instance.

func (*CacheMem) LoadTestData

func (c *CacheMem) LoadTestData(ctx context.Context) db.Error

LoadTestData is a pass through.

func (*CacheMem) ReadApplicationToken

func (c *CacheMem) ReadApplicationToken(ctx context.Context, id int64) (*models.ApplicationToken, db.Error)

ReadApplicationToken returns one application token.

func (*CacheMem) ReadApplicationTokenByToken

func (c *CacheMem) ReadApplicationTokenByToken(ctx context.Context, token string) (*models.ApplicationToken, db.Error)

ReadApplicationTokenByToken returns one application token.

func (*CacheMem) ReadApplicationTokensPage

func (c *CacheMem) ReadApplicationTokensPage(ctx context.Context, index, count int) ([]*models.ApplicationToken, db.Error)

ReadApplicationTokensPage returns a page of application tokens.

func (*CacheMem) ReadByID

func (c *CacheMem) ReadByID(ctx context.Context, id int64, i interface{}) db.Error

ReadByID is a pass through.

func (*CacheMem) ReadFediAccount

func (c *CacheMem) ReadFediAccount(ctx context.Context, id int64) (*models.FediAccount, db.Error)

ReadFediAccount returns one federated social account.

func (*CacheMem) ReadFediAccountByUsername

func (c *CacheMem) ReadFediAccountByUsername(ctx context.Context, instanceID int64, username string) (*models.FediAccount, db.Error)

ReadFediAccountByUsername returns one federated social account.

func (*CacheMem) ReadFediAccountsPage

func (c *CacheMem) ReadFediAccountsPage(ctx context.Context, index, count int) (instances []*models.FediAccount, err db.Error)

ReadFediAccountsPage returns a page of federated social accounts.

func (*CacheMem) ReadFediInstance

func (c *CacheMem) ReadFediInstance(ctx context.Context, id int64) (*models.FediInstance, db.Error)

ReadFediInstance returns one federated social instance.

func (*CacheMem) ReadFediInstanceByDomain

func (c *CacheMem) ReadFediInstanceByDomain(ctx context.Context, domain string) (*models.FediInstance, db.Error)

ReadFediInstanceByDomain returns one federated social instance.

func (*CacheMem) ReadFediInstancesPage

func (c *CacheMem) ReadFediInstancesPage(ctx context.Context, index, count int) ([]*models.FediInstance, db.Error)

ReadFediInstancesPage returns a page of federated social instances.

func (*CacheMem) ReadOauthClient

func (c *CacheMem) ReadOauthClient(ctx context.Context, id int64) (*models.OauthClient, db.Error)

ReadOauthClient returns one oauth client.

func (*CacheMem) ReadOauthClientsPage

func (c *CacheMem) ReadOauthClientsPage(ctx context.Context, index, count int) (clients []*models.OauthClient, err db.Error)

ReadOauthClientsPage returns a page of oauth clients.

func (*CacheMem) ResetCache

func (c *CacheMem) ResetCache(ctx context.Context) db.Error

ResetCache clears all the caches.

func (*CacheMem) Update

func (c *CacheMem) Update(ctx context.Context, i interface{}) db.Error

Update is a pass through.

func (*CacheMem) UpdateApplicationToken

func (c *CacheMem) UpdateApplicationToken(ctx context.Context, applicationToken *models.ApplicationToken) db.Error

UpdateApplicationToken updates the stored application token.

func (*CacheMem) UpdateFediAccount

func (c *CacheMem) UpdateFediAccount(ctx context.Context, account *models.FediAccount) db.Error

UpdateFediAccount updates the stored federated instance and caches it.

func (*CacheMem) UpdateFediInstance

func (c *CacheMem) UpdateFediInstance(ctx context.Context, instance *models.FediInstance) db.Error

UpdateFediInstance updates the stored federated instance and caches it.

func (*CacheMem) UpdateOauthClient

func (c *CacheMem) UpdateOauthClient(ctx context.Context, client *models.OauthClient) (err db.Error)

UpdateOauthClient updates the stored oauth client.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL