Skip to content
/ rc Public

rc is a response cache middleware for cache.

License

Notifications You must be signed in to change notification settings

2manymws/rc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

175dfa7 · Jul 20, 2024
Dec 14, 2023
Mar 1, 2024
Jul 19, 2024
Jul 20, 2024
Sep 5, 2023
Jun 14, 2024
Dec 14, 2023
Oct 3, 2023
Oct 3, 2023
Sep 4, 2023
Sep 4, 2023
Jul 20, 2024
Dec 18, 2023
Sep 4, 2023
Dec 18, 2023
Dec 17, 2023
Dec 18, 2023
Jun 14, 2024
Dec 14, 2023
Dec 15, 2023
Jan 30, 2024
Jul 19, 2024
Jun 13, 2024

Repository files navigation

rc Go Reference build Coverage Code to Test Ratio Test Execution Time

rc is a response cache middleware for cache.

Usage

Prepare an instance that implements rc.Casher interface.

Then, generate the middleware ( func(next http.Handler) http.Handler ) with rc.New

package main

import (
    "log"
    "net/http"

    "github.com/2manymws/rc"
)

func main() {
    r := http.NewServeMux()
    r.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
        w.Write([]byte("Hello World"))
    })

    var c rc.Cacher = newMyCacher()
    m := rc.New(c)

    log.Fatal(http.ListenAndServe(":8080", m(r)))
}

Utility functions

See https://github.com/2manymws/rcutil