memory

package
v1.1.0-beta5 Latest Latest
Warning

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

Go to latest
Published: May 22, 2020 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 packages

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

Overview

Package memory is the memory implementation of the Trickster Cache and uses a sync.Map to manage cache objects

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	Name string

	Config *options.Options
	Index  *index.Index
	Logger *tl.Logger
	// contains filtered or unexported fields
}

Cache defines a a Memory Cache client that conforms to the Cache interface

func (*Cache) BulkRemove

func (c *Cache) BulkRemove(cacheKeys []string)

BulkRemove removes a list of objects from the cache

func (*Cache) Close

func (c *Cache) Close() error

Close is not used for Cache, and is here to fully prototype the Cache Interface

func (*Cache) Configuration

func (c *Cache) Configuration() *options.Options

Configuration returns the Configuration for the Cache object

func (*Cache) Connect

func (c *Cache) Connect() error

Connect initializes the Cache

func (*Cache) Locker

func (c *Cache) Locker() locks.NamedLocker

Locker returns the cache's locker

func (*Cache) Remove

func (c *Cache) Remove(cacheKey string)

Remove removes an object from the cache

func (*Cache) Retrieve

func (c *Cache) Retrieve(cacheKey string, allowExpired bool) ([]byte, status.LookupStatus, error)

Retrieve looks for an object in cache and returns it (or an error if not found)

func (*Cache) RetrieveReference

func (c *Cache) RetrieveReference(cacheKey string, allowExpired bool) (interface{},
	status.LookupStatus, error)

RetrieveReference looks for an object in cache and returns it (or an error if not found)

func (*Cache) SetLocker

func (c *Cache) SetLocker(l locks.NamedLocker)

SetLocker sets the cache's locker

func (*Cache) SetTTL

func (c *Cache) SetTTL(cacheKey string, ttl time.Duration)

SetTTL updates the TTL for the provided cache object

func (*Cache) Store

func (c *Cache) Store(cacheKey string, data []byte, ttl time.Duration) error

Store places an object in the cache using the specified key and ttl

func (*Cache) StoreReference

func (c *Cache) StoreReference(cacheKey string, data cache.ReferenceObject, ttl time.Duration) error

StoreReference stores an object directly to the memory cache without requiring serialization

Jump to

Keyboard shortcuts

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