sharecache

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 17 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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