redis

package
v0.0.0-...-d834ed6 Latest Latest
Warning

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

Go to latest
Published: May 13, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package redis provides a redis interface for http caching.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	*redis.Pool
}

Cache is an implementation of httpcache.Cache that caches responses in a redis server.

func NewWithClient

func NewWithClient(client *redis.Pool) *Cache

NewWithClient returns a new Cache with the given redis pool.

func (*Cache) Delete

func (c *Cache) Delete(key string)

Delete removes the response with key from the cache.

func (*Cache) Get

func (c *Cache) Get(key string) (resp []byte, ok bool)

Get returns the response corresponding to key if present.

func (*Cache) Set

func (c *Cache) Set(key string, resp []byte)

Set saves a response to the cache as key and set to expire after the duration.

Jump to

Keyboard shortcuts

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