Skip to content

sdvcrx/echo-cache

Repository files navigation

echo-cache

Build Status PkgGoDev

A simple echo Cache middleware.

Install

go get -u github.com/sdvcrx/echo-cache

Usage

Basic Usage

import (
    "github.com/sdvcrx/echo-cache"
)

// ...

e.Use(cache.Cache())

Custom Configuration

e.Use(cache.CacheWithConfig(cache.CacheConfig{
  // ...
}))

Configuration:

type CacheConfig struct {
    Skipper          middleware.Skipper
    CanCacheResponse middleware.Skipper
    CachePrefix      string
    CacheKey         CacheKeyFunc
    CacheDuration    time.Duration
    Store            store.Store
    Encoder          Encoder
}

LICENSE

MIT