cache

package
v0.0.0-...-642d756 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package cache implements a redis-based page cache for pkgsite.

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 a Redis-based cache.

func New

func New(client *redis.Client) *Cache

New creates a new Cache using the given Redis client.

func (*Cache) Clear

func (c *Cache) Clear(ctx context.Context) (err error)

Clear deletes all entries from the cache.

func (*Cache) Delete

func (c *Cache) Delete(ctx context.Context, keys ...string) (err error)

Delete deletes the given keys. It does not return an error if a key does not exist.

func (*Cache) DeletePrefix

func (c *Cache) DeletePrefix(ctx context.Context, prefix string) (err error)

DeletePrefix deletes all keys beginning with prefix.

func (*Cache) Get

func (c *Cache) Get(ctx context.Context, key string) (value []byte, err error)

Get returns the value for key, or nil if the key does not exist.

func (*Cache) Put

func (c *Cache) Put(ctx context.Context, key string, data []byte, ttl time.Duration) (err error)

Put inserts the key with the given data and time-to-live.

Jump to

Keyboard shortcuts

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