cache

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type URLCache

type URLCache interface {
	// Create is a method that adds a new URL to the cache.
	// It takes a context for managing the lifecycle of the operation,
	// a hash which is the unique identifier for the URL,
	// the actual URL string, and an expiration time for the cache entry.
	// It returns an error if the operation fails.
	Create(ctx context.Context, hash, url string, expiration time.Duration) error

	// Get is a method that retrieves a URL from the cache using its hash.
	// It takes a context for managing the lifecycle of the operation,
	// and the hash of the URL to retrieve.
	// It returns a pointer to a URL model if the operation is successful,
	// and an error if the operation fails or if the URL is not found in the cache.
	Get(ctx context.Context, hash string) (*models.URL, error)
}

URLCache is an interface that defines the methods for URL caching.

Directories

Path Synopsis
redis
url

Jump to

Keyboard shortcuts

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