debrid

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2021 License: AGPL-3.0 Imports: 2 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 interface {
	Set(key string) error
	Get(key string) (time.Time, bool, error)
}

Cache is the interface that the debrid clients uses for caching a user's API token validity and the "instant availability" of a torrent (via info_hash). A package user must pass an implementation of this interface. Usually you create a simple wrapper around an existing cache package. An example implementation is the InMemoryCache in this package.

type InMemoryCache

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

InMemoryCache is an example implementation of the Cache interface. It doesn't persist its data, so it's not suited for production use of the debrid packages.

func NewInMemoryCache

func NewInMemoryCache() *InMemoryCache

NewInMemoryCache creates a new InMemoryCache.

func (*InMemoryCache) Get

func (c *InMemoryCache) Get(key string) (time.Time, bool, error)

Get returns the time the API token / "instant availability" was cached. The boolean return value signals if the value was found in the cache.

func (*InMemoryCache) Set

func (c *InMemoryCache) Set(key string) error

Set caches the validity of a user's API token or the "instant availability" for a torrent (via info_hash). There's no need to pass a boolean or so - if a value gets cached it means the token is valid / the torrent is "instantly available".

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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