caches

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeStandalone = "standalone"
	ModeCluster    = "cluster"
	ModeRing       = "ring"
)

Variables

Functions

func HostAndPortArrayToStringArray

func HostAndPortArrayToStringArray(servers []HostAndPort) []string

Types

type Cache

type Cache interface {
	Lookup(t internal.TileRequest) (*internal.Image, error)
	Save(t internal.TileRequest, img *internal.Image) error
}

func ConstructCache

func ConstructCache(rawConfig map[string]interface{}, errorMessages *config.ErrorMessages) (Cache, error)

type Disk

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

func ConstructDisk

func ConstructDisk(config DiskConfig, ErrorMessages *config.ErrorMessages) (*Disk, error)

func (Disk) Lookup

func (c Disk) Lookup(t internal.TileRequest) (*internal.Image, error)

func (Disk) Save

func (c Disk) Save(t internal.TileRequest, img *internal.Image) error

type DiskConfig

type DiskConfig struct {
	Path     string
	FileMode uint32
}

type HostAndPort

type HostAndPort struct {
	Host string
	Port uint16
}

Utility type used in a couple caches

func (HostAndPort) String

func (hp HostAndPort) String() string

type Memcache

type Memcache struct {
	*MemcacheConfig
	// contains filtered or unexported fields
}

func ConstructMemcache

func ConstructMemcache(config *MemcacheConfig, errorMessages *config.ErrorMessages) (*Memcache, error)

func (Memcache) Lookup

func (c Memcache) Lookup(t internal.TileRequest) (*internal.Image, error)

func (Memcache) Save

func (c Memcache) Save(t internal.TileRequest, img *internal.Image) error

type MemcacheConfig

type MemcacheConfig struct {
	HostAndPort `mapstructure:",squash"`
	Servers     []HostAndPort //The list of servers to use.
	KeyPrefix   string        //Prefix to keynames stored in cache
	Ttl         uint32        //Cache expiration in seconds. Max of 30 days. Default to 1 day
}

type Memory

type Memory struct {
	MemoryConfig
	Cache otter.Cache[string, []byte]
}

func ConstructMemory

func ConstructMemory(config MemoryConfig, ErrorMessages *config.ErrorMessages) (*Memory, error)

func (Memory) Lookup

func (c Memory) Lookup(t internal.TileRequest) (*internal.Image, error)

func (Memory) Save

func (c Memory) Save(t internal.TileRequest, img *internal.Image) error

type MemoryConfig

type MemoryConfig struct {
	MaxSize uint16 //Maximum number of tiles to hold in the cache. Defaults to 100
	Ttl     uint32 //Maximum time to live of a tile in seconds. Defaults to 3600 (1 hour)
}

type Multi

type Multi struct {
	Tiers []Cache
}

func (Multi) Lookup

func (c Multi) Lookup(t internal.TileRequest) (*internal.Image, error)

func (Multi) Save

func (c Multi) Save(t internal.TileRequest, img *internal.Image) error

type MultiConfig

type MultiConfig struct {
	Tiers []map[string]interface{}
}

type Noop

type Noop struct {
}

func (Noop) Lookup

func (c Noop) Lookup(t internal.TileRequest) (*internal.Image, error)

func (Noop) Save

func (c Noop) Save(t internal.TileRequest, img *internal.Image) error

type Redis

type Redis struct {
	*RedisConfig
	// contains filtered or unexported fields
}

func ConstructRedis

func ConstructRedis(config *RedisConfig, errorMessages *config.ErrorMessages) (*Redis, error)

func (Redis) Lookup

func (c Redis) Lookup(t internal.TileRequest) (*internal.Image, error)

func (Redis) Save

func (c Redis) Save(t internal.TileRequest, img *internal.Image) error

type RedisConfig

type RedisConfig struct {
	HostAndPort `mapstructure:",squash"` //Host and Port for a single server. A convenience equivalent to supplying Servers with a single entry
	Db          int                      //Database number, defaults to 0
	KeyPrefix   string                   //Prefix to keynames stored in cache
	Username    string                   //Username to use to authenticate
	Password    string                   //Password to use to authenticate
	Mode        string                   //Controls operating mode. One of AllModes. Defaults to standalone
	Ttl         uint32                   //Cache expiration in seconds. Max of 1 year. Default to 1 day
	Servers     []HostAndPort            //The list of servers to use.
}

type S3

type S3 struct {
	*S3Config
	// contains filtered or unexported fields
}

func ConstructS3

func ConstructS3(config *S3Config, errorMessages *config.ErrorMessages) (*S3, error)

func (S3) Lookup

func (c S3) Lookup(t internal.TileRequest) (*internal.Image, error)

func (S3) Save

func (c S3) Save(t internal.TileRequest, img *internal.Image) error

type S3Config

type S3Config struct {
	Bucket       string
	Access       string
	Secret       string
	Region       string
	Path         string
	Profile      string
	StorageClass string
	Endpoint     string //For directory buckets or non-s3
	UsePathStyle bool   //For testing purposes and maybe real non-S3 usage
}

Jump to

Keyboard shortcuts

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