cachexp

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2018 License: MIT Imports: 1 Imported by: 0

README

cachexp

Build Status Coverage Status GoDoc Go Report Card

Documentation

Overview

Package cachexp provides cache expansion mechanism using selected Provider.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Expand

func Expand(c Provider, b []byte, r *http.Request) ([]byte, error)

Expand process expansion of the b using selected Provider. When r provided, it can be used by Provider to fetch data from remote backend when no local data is not exist during expansion.

Types

type Provider

type Provider interface {
	Marshal(v interface{}) ([]byte, error)
	Unmarshal(b []byte, v interface{}) error

	ReadFetch(key string, r *http.Request) ([]byte, error)
	ReadFetchMulti(keys []string, r *http.Request) (map[string][]byte, error)

	Normalize(key string) string
	Tuner() Tuner
}

A Provider provides data and transformation for the Expand function. It's also provides Tuner to customize behaviour of the expansion.

type Tuner

type Tuner interface {
	ExpandKey() string
	PlaceholderKey() string
	ExpandDepth() int
	IsExcluded(key string) bool
}

Tuner allows cutomization during the expansion.

Jump to

Keyboard shortcuts

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