cachebackend

package
v0.0.0-...-f0491b5 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const InvalidateURLPath = "/api/internal/cache_invalidate"

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheBackend

type CacheBackend struct {
	as.Backend
	http.Handler
	// contains filtered or unexported fields
}

CacheBackend is both an accountserver Backend and a http.Handler that implements the replicated invalidation RPCs.

CacheBackend implements a simple in-memory cache of user objects (not resources yet), in order to reduce the database and processing load in presence of a heavily read-oriented workload. The cache is very simple, and any update to a user or its resources cause us to go back to the database backend.

User objects are kept in memory for a short while and periodically cleaned up. Memory usage thus depends on the load and is difficult to estimate in advance.

func Wrap

func Wrap(b as.Backend, peers []string, tls *clientutil.TLSClientConfig) (*CacheBackend, error)

Wrap a Backend with a cache.

func (*CacheBackend) NewTransaction

func (b *CacheBackend) NewTransaction() (as.TX, error)

NewTransaction returns a new accountserver.TX unit-of-work object.

type InvalidateUserRequest

type InvalidateUserRequest struct {
	Username string `json:"username"`
}

Jump to

Keyboard shortcuts

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