cache

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2019 License: Apache-2.0 Imports: 8 Imported by: 2 modules, 1 package

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 MemoryCache

type MemoryCache map[string]*Node

MemoryCache maintains a mapping of dinghyfiles and their dependencies

func NewMemoryCache

func NewMemoryCache() MemoryCache

NewMemoryCache initializes a new cache

func (MemoryCache) Dump

func (c MemoryCache) Dump()

Dump prints the cache, used for debugging

func (MemoryCache) GetRoots

func (c MemoryCache) GetRoots(url string) []string

GetRoots returns all roots for a given leaf

func (MemoryCache) SetDeps

func (c MemoryCache) SetDeps(parent string, deps []string)

SetDeps sets the dependencies for a parent

func (MemoryCache) UpstreamURLs

func (c MemoryCache) UpstreamURLs(url string) ([]string, []string)

UpstreamURLs returns two arrays: 1) Array of all upstream URLs from a URL 2) Array of only the root URLs (dinghyfiles) for a given URL

type Node

type Node struct {
	URL      string
	Children []*Node
	Parents  []*Node
}

Node represents either a dinghyfile or a module. The URL is the github URL for the dinghyfile or module that can optionally include the commit hash for versioning purposes.

func NewNode

func NewNode(url string) *Node

NewNode allocates a new node in the cache

func (*Node) String

func (n *Node) String() string

type RedisCache

type RedisCache struct {
	Client *redis.Client
	Logger *log.Entry
	// contains filtered or unexported fields
}

RedisCache maintains a dependency graph inside Redis

func NewRedisCache

func NewRedisCache(redisOptions *redis.Options, logger *log.Logger, ctx context.Context, stop chan os.Signal) *RedisCache

NewRedisCache initializes a new cache

func (*RedisCache) Clear

func (c *RedisCache) Clear()

Clear clears everything

func (*RedisCache) GetRoots

func (c *RedisCache) GetRoots(url string) []string

GetRoots grabs roots

func (*RedisCache) SetDeps

func (c *RedisCache) SetDeps(parent string, deps []string)

SetDeps sets dependencies for a parent

Directories

Path Synopsis
Package local provides a goroutine safe map for caching.
Package local provides a goroutine safe map for caching.

Jump to

Keyboard shortcuts

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