Skip to content

gitsight/go-echo-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

286e58c · May 21, 2021

History

7 Commits
May 19, 2021
May 19, 2021
May 19, 2021
May 19, 2021
May 21, 2021
May 21, 2021
May 18, 2021
May 18, 2021
May 21, 2021
May 21, 2021

Repository files navigation

go-echo-cache GoDoc Test

go-echo-cache, is a server-side HTTP cache middleware designed to work with Echo framework.

The in-memory cache is managed by freecache, a cache library with zero GC overhead and high concurrent performance.

Installation

The recommended way to install go-echo-cache is:

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

Examples

Basic example

A basic example that mimics the standard git clone command

package main

import (
	"net/http"
	"time"

	"github.com/coocood/freecache"
	cache "github.com/gitsight/go-echo-cache"
	"github.com/labstack/echo/v4"
)

func main() {
	c := freecache.NewCache(1024 * 1024) // Pre-allocated cache of 1Mb)

	e := echo.New()
	e.Use(cache.New(&cache.Config{}, c))
	e.GET("/", func(c echo.Context) error {
		c.String(http.StatusOK, time.Now().String())
		return nil
	})

	e.Start(":8080")
}

License

Apache License Version 2.0, see LICENSE

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages