Tail is a easy to use caching system for your web project. It include multiple caching platform {redis, bolt, in memory} and more will come later. Once the ressource is in cache tail will update it if any change happen.
package main
import(
"net/http"
// Main package for using tail
"github.com/go-zoo/tail"
// import depend of the platform you choose
"github.com/go-zoo/tail/rediscache"
)
var (
// Create the cache platform with your parameters
cache, _ = rediscache.New("tcp", "localhost:6379")
// Create a new template that takes (id, path, cachePlatform)
indexTemplate = tail.New("index", "template/index.html", cache)
)
func main () {
http.HandleFunc("/", indexHandler)
http.ListenAndServe(":8080", mux)
}
func indexHandler(rw http.ResponseWriter, req *http.Request) {
rw.Write(indexTemplate.Get(req.RemoteAddr))
}
- More Functionnalities
- DOC
- More Testing
- Debugging
- Optimisation
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Write Tests!
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request
MIT
Lightning fast http Multiplexer : Bone