cache

package
v0.0.0-...-f23b7a0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Get(key string) ([]byte, error)
	Set(key string, val []byte, exp time.Duration) error
	Delete(key string) error
	Reset() error
	Close() error
}

func NewMongoCacheDB

func NewMongoCacheDB(mongoInstance *db.MongoInstance, config *configs.Config) (Cache, error)

type Storage

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

Storage interface that is implemented by storage providers

func (*Storage) Close

func (s *Storage) Close() error

Close the database

func (*Storage) Delete

func (s *Storage) Delete(key string) error

Delete document by key

func (*Storage) Get

func (s *Storage) Get(key string) ([]byte, error)

Get value by key

func (*Storage) Reset

func (s *Storage) Reset() error

Reset all keys by drop collection

func (*Storage) Set

func (s *Storage) Set(key string, val []byte, exp time.Duration) error

Set key with value, replace if document exits

document will be remove automatically if exp is set, based on MongoDB TTL Indexes Set key with value

Jump to

Keyboard shortcuts

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