mongocache

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package mongocache implements the presto.Cache interface using a mongodb database for persistent storage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoCache

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

MongoCache represents a single database connection

func New

func New(client *mongo.Client, database string, collection string) *MongoCache

New returns a fully initialized mongodb cache

func (*MongoCache) Get

func (cache *MongoCache) Get(key string) string

Get retrieves a single value from the cache. If the value does not exist in the cache, then "" is returned

func (*MongoCache) Set

func (cache *MongoCache) Set(key string, value string) *derp.Error

Set adds/updates a value in the cache.

type Record

type Record struct {
	ID    primitive.ObjectID `bson:"_id"`
	Key   string             `bson:"key"`
	Value string             `bson:"value"`
}

Record represents the key/value pair that is written into the mongodb cache.

Jump to

Keyboard shortcuts

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