diskCache

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: MIT Imports: 5 Imported by: 0

README

go-disk-cache

Documentation

Index

Constants

View Source
const CACHE_SEPERATOR = "|"
View Source
const DEFAULT_EXPIRY = 84000 // 1 Day
View Source
const NO_EXPIRY = -1

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Get(key string) (string, error)
	Set(key string, value string) error
	SetWithExpiry(key string, value string, expiry int) error
	Delete(key string) error
}

Cache interface defines the methods for interacting with the cache

func New

func New(conf *Config) (Cache, error)

New creates and returns a new Cache object based on the provided configuration.

type Config

type Config struct {
	Expiry    int    // Expiry time in seconds
	Location  string // Location where cache data will be stored
	SubFolder string // Subfolder within the location to store cache data
}

Config represents the configuration for creating a new cache instance

Jump to

Keyboard shortcuts

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