Help us shape the future of Go! Take the 2026 Go Developer Survey

sharecache

package
v2.52.1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	UserShares mtimesyncedcache.Map[string, *UserShareCache]
	// contains filtered or unexported fields
}

Cache caches the list of share ids for users/groups It functions as an in-memory cache with a persistence layer The storage is sharded by user/group

func New

func New(s metadata.Storage, namespace, filename string, ttl time.Duration) Cache

New returns a new Cache instance

func (*Cache) Add

func (c *Cache) Add(ctx context.Context, id utils.FilenameEncoder, shareID string) error

Add adds a share to the cache

func (*Cache) List

List return the list of spaces/shares for the given user/group

func (*Cache) Persist

func (c *Cache) Persist(ctx context.Context, key string) error

Persist persists the data for one user/group to the storage

func (*Cache) Remove

func (c *Cache) Remove(ctx context.Context, id utils.FilenameEncoder, shareID string) error

Remove removes a share for the given user

type SpaceShareIDs

type SpaceShareIDs struct {
	IDs map[string]struct{}
}

SpaceShareIDs holds the unique list of share ids for a space

type UserShareCache

type UserShareCache struct {
	UserShares map[string]*SpaceShareIDs

	Etag string
}

UserShareCache holds the space/share map for one user

Jump to

Keyboard shortcuts

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