autocertcache

package module
v0.0.0-...-e372856 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2019 License: MIT Imports: 5 Imported by: 0

README

AutoCert Cache

AutoCert Cache are implementations of the Cache interface for Golang's autocert package.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Firestore

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

Firestore is an autocert.Cache that works with Google's Firestore.

func NewFirestore

func NewFirestore(cr *firestore.CollectionRef) *Firestore

NewFirestore returns a new Firestore using cr as the collection for cache. If cr is nil, NewFirestore returns nil.

func (Firestore) Delete

func (fs Firestore) Delete(ctx context.Context, key string) error

Delete removes a certificate data from the cache under the specified key. If there's no such key in the cache, Delete returns nil.

func (Firestore) Get

func (fs Firestore) Get(ctx context.Context, key string) ([]byte, error)

Get returns a certificate data for the specified key. If there's no such key, Get returns ErrCacheMiss.

func (Firestore) Put

func (fs Firestore) Put(ctx context.Context, key string, data []byte) error

Put stores the data in the cache under the specified key. Underlying implementations may use any data storage format, as long as the reverse operation, Get, results in the original data.

type SQL

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

SQL is the base type for SQL caches.

func NewSQLite

func NewSQLite(db *sql.DB, table string) (*SQL, error)

NewSQLite returns a new initialized SQL for the database db in SQLite format. NewSQLite will create a new table if one does not already exists.

func (SQL) Close

func (s SQL) Close() error

Close the SQL statments to the database.

func (SQL) Delete

func (s SQL) Delete(ctx context.Context, key string) error

Delete removes a certificate data from the cache under the specified key. If there's no such key in the cache, Delete returns nil.

func (SQL) Get

func (s SQL) Get(ctx context.Context, key string) ([]byte, error)

Get returns a certificate data for the specified key. If there's no such key, Get returns ErrCacheMiss.

func (SQL) Put

func (s SQL) Put(ctx context.Context, key string, data []byte) error

Put stores the data in the cache under the specified key. Underlying implementations may use any data storage format, as long as the reverse operation, Get, results in the original data.

Jump to

Keyboard shortcuts

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