cache

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2022 License: BSD-3-Clause Imports: 21 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 {
	Get(string) (CacheItem, error)
	Set(string, CacheItem) error
	Hits() int64
	Misses() int64
	Evictions() int64
	Size() int64
	Close() error
}

func NewFSCache

func NewFSCache(data_root string) (Cache, error)

func NewGoCache

func NewGoCache(opts *GoCacheOptions) (Cache, error)

func NewSQLiteCache

func NewSQLiteCache(db *database.SQLiteDatabase) (Cache, error)

type CacheItem

type CacheItem interface {
	SPR() spr.StandardPlacesResult
	Polygons() []geojson.Polygon
	Geometry() pip.GeoJSONGeometry
}

func NewFeatureCache

func NewFeatureCache(f geojson.Feature) (CacheItem, error)

type FSCache

type FSCache struct {
	Cache
	Logger *log.WOFLogger
	// contains filtered or unexported fields
}

func (*FSCache) Close

func (c *FSCache) Close() error

func (*FSCache) Evictions

func (c *FSCache) Evictions() int64

func (*FSCache) Get

func (c *FSCache) Get(key string) (CacheItem, error)

func (*FSCache) Hits

func (c *FSCache) Hits() int64

func (*FSCache) Misses

func (c *FSCache) Misses() int64

func (*FSCache) Set

func (c *FSCache) Set(key string, i CacheItem) error

func (*FSCache) Size

func (c *FSCache) Size() int64

type FeatureCache

type FeatureCache struct {
	CacheItem       `json:",omitempty"`
	FeatureSPR      spr.StandardPlacesResult `json:"spr"`
	FeaturePolygons []geojson.Polygon        `json:"polygons"`
}

func (*FeatureCache) Geometry

func (fc *FeatureCache) Geometry() pip.GeoJSONGeometry

func (*FeatureCache) Polygons

func (fc *FeatureCache) Polygons() []geojson.Polygon

func (*FeatureCache) SPR

func (fc *FeatureCache) SPR() spr.StandardPlacesResult

type GoCache

type GoCache struct {
	Cache
	Logger  *log.WOFLogger
	Options *GoCacheOptions
	// contains filtered or unexported fields
}

func (*GoCache) Close

func (c *GoCache) Close() error

func (*GoCache) Evictions

func (c *GoCache) Evictions() int64

func (*GoCache) Get

func (c *GoCache) Get(key string) (CacheItem, error)

func (*GoCache) Hits

func (c *GoCache) Hits() int64

func (*GoCache) Misses

func (c *GoCache) Misses() int64

func (*GoCache) Set

func (c *GoCache) Set(key string, item CacheItem) error

func (*GoCache) Size

func (c *GoCache) Size() int64

type GoCacheOptions

type GoCacheOptions struct {
	CacheSize         int
	CacheTrigger      int
	DefaultExpiration time.Duration
	CleanupInterval   time.Duration
}

func DefaultGoCacheOptions

func DefaultGoCacheOptions() (*GoCacheOptions, error)

func (*GoCacheOptions) String

func (o *GoCacheOptions) String() string

type SQLiteCache

type SQLiteCache struct {
	Cache
	Logger *log.WOFLogger
	// contains filtered or unexported fields
}

func (*SQLiteCache) Close

func (c *SQLiteCache) Close() error

func (*SQLiteCache) Evictions

func (c *SQLiteCache) Evictions() int64

func (*SQLiteCache) Get

func (c *SQLiteCache) Get(key string) (CacheItem, error)

func (*SQLiteCache) Hits

func (c *SQLiteCache) Hits() int64

func (*SQLiteCache) Misses

func (c *SQLiteCache) Misses() int64

func (*SQLiteCache) Set

func (c *SQLiteCache) Set(key string, item CacheItem) error

func (*SQLiteCache) Size

func (c *SQLiteCache) Size() int64

Jump to

Keyboard shortcuts

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