cache

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package cache contains common interface for caches with Get, Delete and Set methods and in memory cache implementation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	Get(key string) (string, error)
	Set(key, object string)
	Delete(key string)
}

Interface contains methods for caches

type MemCache

type MemCache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

MemCache is an implementation of Interface

func NewMemCache

func NewMemCache() *MemCache

NewMemCache is a constructor for MemCache

func (*MemCache) Delete

func (c *MemCache) Delete(key string)

Delete deletes object from MemCache with given key

func (*MemCache) Get

func (c *MemCache) Get(key string) (string, error)

Get return item from MemCache using given key or error in case of missing key

func (*MemCache) Set

func (c *MemCache) Set(key, object string)

Set adds object to MemCache with given key

Jump to

Keyboard shortcuts

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