package cache
import "golang.org/x/pkgsite/internal/cache"
Package cache implements a redis-based page cache for pkgsite.
Index ¶
- type Cache
- func New(client *redis.Client) *Cache
- func (c *Cache) Clear(ctx context.Context) (err error)
- func (c *Cache) Delete(ctx context.Context, keys ...string) (err error)
- func (c *Cache) DeletePrefix(ctx context.Context, prefix string) (err error)
- func (c *Cache) Get(ctx context.Context, key string) (value []byte, err error)
- func (c *Cache) Put(ctx context.Context, key string, data []byte, ttl time.Duration) (err error)
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 ¶
Clear deletes all entries from the cache.
func (*Cache) Delete ¶
Delete deletes the given keys. It does not return an error if a key does not exist.
func (*Cache) DeletePrefix ¶
DeletePrefix deletes all keys beginning with prefix.
func (*Cache) Get ¶
Get returns the value for key, or nil if the key does not exist.
func (*Cache) Put ¶
Put inserts the key with the given data and time-to-live.
Source Files ¶
cache.go
- Version
- v0.0.0-20250218150137-224a1368cf02 (latest)
- Published
- Feb 18, 2025
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 2 months ago –
Tools for package owners.