teracache

package module
v0.0.0-...-654a8ab Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

README

Teracache
build-status License Release Version Documentation

Teracache is a scalable, decentralized, highly-available in-memory cache for read-asymmetrical workflows.

Workflow

The workflow diagram depicts a system with multiple topics and nodes where each color represents the topic they're in.

workflow-diagram

What is Read-Asymmetrical?

In a read-asymmetrical workflow, reads are frequent while the writes are rare. For example a newsfeed will resize and optimize a thumbnail when a new article arrives and then serve the optimized thumbnail to thousands or millions of users.

In such cases, it is very profitable to use a cache that doesn't sacrifice performance to allow write operations. Teracache does exactly this trade-off.

How to use invalidations?

Cache entries are immutable and no entry is considered stale. Entries are evicted only to admit more popular entries.

Inspired By

Documentation

Index

Constants

View Source
const (
	RouterPort  = 20274
	ServicePort = 20275
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	Get(context.Context, string) (payload.Payload, error)
}

func New

func New(t Topic) (Interface, error)

New creates a cache instance that participates in the given topic. Once a Get request to the cache fails, the cache uses the topic provider function to retrieve the missing element. The cache is bootstrapped using the given peer addresses.

type Provider

type Provider func(ctx context.Context, key string) (payload.Payload, error)

type Topic

type Topic struct {
	ID       string
	Capacity int
	Peers    []string
	Provider Provider
}

Directories

Path Synopsis
hash
Package hash contains types for hashing and consistent hash rings
Package hash contains types for hashing and consistent hash rings
Package service is a generated protocol buffer package.
Package service is a generated protocol buffer package.
Package with contains context managers for objects that require initialization before and clean-up after the execution such as files, locks, connections.
Package with contains context managers for objects that require initialization before and clean-up after the execution such as files, locks, connections.

Jump to

Keyboard shortcuts

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