Documentation ¶
Overview ¶
package cache stores data in memeory to reduce database calls and increase speed of data fetching
Index ¶
- func NewRunTimer(name string, logger *logger.Logger) *runTimer
- type AccountsForUser
- type Cache
- func (c *Cache) GetAccount(accountID types.AccountID) types.Account
- func (c *Cache) GetAccounts(options Options) []types.Account
- func (c *Cache) GetBlockedContracts() types.GlobalBlockedContracts
- func (c *Cache) GetChain(chainID types.RelayChainID, options Options) types.Chain
- func (c *Cache) GetChains(options Options) []types.Chain
- func (c *Cache) GetGatewayConfig(env types.Environment) types.GatewayConfig
- func (c *Cache) GetGigastakeAppByID(gigastakeAppID types.GigastakeAppID) types.GigastakeApp
- func (c *Cache) GetGigastakeApps(options Options) []types.GigastakeApp
- func (c *Cache) GetOpenAPISpecs() map[types.RelayChainID]json.RawMessage
- func (c *Cache) GetPlan(planType types.PayPlanType) types.Plan
- func (c *Cache) GetPlans() []types.Plan
- func (c *Cache) GetPortalApp(portalAppID types.PortalAppID) types.PortalApp
- func (c *Cache) GetPortalApps(options Options) []types.PortalApp
- func (c *Cache) GetPortalAppsByUserID(userID types.UserID) []types.PortalApp
- func (c *Cache) GetPortalAppsForMiddleware() []types.PortalAppLite
- func (c *Cache) GetUserAccount(accountID types.AccountID, userID types.UserID, options Options) types.Account
- func (c *Cache) GetUserAccounts(userID types.UserID, options Options) []types.Account
- func (c *Cache) GetUserByID(userID types.UserID) types.User
- func (c *Cache) GetUserByProviderID(providerUserID types.ProviderUserID) types.User
- func (c *Cache) GetValidatorConfig() types.ValidatorPluginConfig
- func (c *Cache) ResetCache(ctx context.Context) error
- type Config
- type Options
- type ReaderMock
- type UsersForAccount
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRunTimer ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
The Cache struct provides an in-memory cache for data used across the Portal API backend architecture. It allows for efficient querying, insertion, and updating of these entities through appropriate cache methods.
It also uses a Listener that listens for Postgres Notifications in order to update multiple instances of the Cache in response to inserts, updates and deletes on a single Postgres database.
func NewCache ¶
NewCache returns cache instance from reader interface and starts the cache refresh handler and listener in separate goroutines
func (*Cache) GetAccount ¶ added in v2.5.0
GetAccount returns one Accounts from cache
func (*Cache) GetAccounts ¶
GetAccounts returns all Accounts in cache May select whether to include deleted Accounts. Default: false
func (*Cache) GetBlockedContracts ¶
func (c *Cache) GetBlockedContracts() types.GlobalBlockedContracts
GetBlockedContracts returns all global blocked contracts
func (*Cache) GetGatewayConfig ¶ added in v2.14.0
func (c *Cache) GetGatewayConfig(env types.Environment) types.GatewayConfig
GetGatewayConfig returns the GatewayConfig from the cache
func (*Cache) GetGigastakeAppByID ¶
func (c *Cache) GetGigastakeAppByID(gigastakeAppID types.GigastakeAppID) types.GigastakeApp
GetGigastakeAppByID returns GigastakeApp from cache by aatID
func (*Cache) GetGigastakeApps ¶
func (c *Cache) GetGigastakeApps(options Options) []types.GigastakeApp
GetGigastakeApps returns all GigastakeApps in cache
func (*Cache) GetOpenAPISpecs ¶ added in v2.11.0
func (c *Cache) GetOpenAPISpecs() map[types.RelayChainID]json.RawMessage
GetOpenAPISpecs returns the OpenAPISpecs from the cache
func (*Cache) GetPlan ¶
func (c *Cache) GetPlan(planType types.PayPlanType) types.Plan
GetPlan returns Plan from cache by planType
func (*Cache) GetPortalApp ¶
func (c *Cache) GetPortalApp(portalAppID types.PortalAppID) types.PortalApp
GetPortalApp returns PortalApp from cache by portalAppID
func (*Cache) GetPortalApps ¶
GetPortalApps returns all PortalApps in cache
func (*Cache) GetPortalAppsByUserID ¶
func (*Cache) GetPortalAppsForMiddleware ¶
func (c *Cache) GetPortalAppsForMiddleware() []types.PortalAppLite
GetPortalAppsForMiddleware returns all PortalAppLites in cache
func (*Cache) GetUserAccount ¶
func (c *Cache) GetUserAccount(accountID types.AccountID, userID types.UserID, options Options) types.Account
GetUserAccount returns one Account by accountID with portal apps filtered by user ID
func (*Cache) GetUserAccounts ¶
func (*Cache) GetUserByID ¶
GetUserByID returns the Portal User for a given portal UserID
func (*Cache) GetUserByProviderID ¶
func (c *Cache) GetUserByProviderID(providerUserID types.ProviderUserID) types.User
GetUserByProviderID returns the Portal User for a given provider UserID
func (*Cache) GetValidatorConfig ¶ added in v2.8.0
func (c *Cache) GetValidatorConfig() types.ValidatorPluginConfig
GetValidatorConfig returns the ValidatorPluginConfig from the cache
type ReaderMock ¶
type ReaderMock struct { driver.MockDriver // contains filtered or unexported fields }
func NewReaderMock ¶
func NewReaderMock(t *testing.T) (*ReaderMock, context.CancelFunc)
func (*ReaderMock) NotificationChannel ¶
func (r *ReaderMock) NotificationChannel() <-chan *types.Notification