cache

package
v0.0.0-...-905232f Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostgresCacher

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

PostgresCacher represents a postgres cache adapter implementation.

func NewPostgresCacher

func NewPostgresCacher() *PostgresCacher

NewPostgresCacher creates and returns a new postgres cacher.

func (*PostgresCacher) Decr

func (c *PostgresCacher) Decr(key string) error

Decrease cached int value.

func (*PostgresCacher) Delete

func (c *PostgresCacher) Delete(key string) error

Delete deletes cached value by given key.

func (*PostgresCacher) Flush

func (c *PostgresCacher) Flush() error

Flush deletes all cached data.

func (*PostgresCacher) Get

func (c *PostgresCacher) Get(key string) interface{}

Get gets cached value by given key.

func (*PostgresCacher) Incr

func (c *PostgresCacher) Incr(key string) error

Incr increases cached int-type value by given key as a counter.

func (*PostgresCacher) IsExist

func (c *PostgresCacher) IsExist(key string) bool

IsExist returns true if cached value exists.

func (*PostgresCacher) Put

func (c *PostgresCacher) Put(key string, val interface{}, expire int64) error

Put puts value into cache with key and expire time. If expired is 0, it will be deleted by next GC operation.

func (*PostgresCacher) StartAndGC

func (c *PostgresCacher) StartAndGC(opt cache.Options) (err error)

StartAndGC starts GC routine based on config string settings.

Jump to

Keyboard shortcuts

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