cache

package
v0.0.0-...-e62c570 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package cache provides cache wrapper for the application

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache is wrapper struct around bitcask with helper methods for app/api-clients access patterns

func NewCache

func NewCache(appPath string) (*Cache, error)

NewCache returns pointer to new app cache or error if encountered

func (*Cache) Close

func (c *Cache) Close() error

Close closes the wrapped bitcask db object

func (*Cache) LookupCached

func (c *Cache) LookupCached(key []byte) (*[]byte, error)

LookupCached checks for a value in cache, returns pointer to slice of bytes if exists or error if encountered

func (*Cache) SetCacheKey

func (c *Cache) SetCacheKey(key, value []byte, ttl *time.Duration) error

SetCacheKey sets a key with value (slice of bytes) for given ttl or without if ttl is nil

Jump to

Keyboard shortcuts

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