mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-05-17 07:45:13 +02:00
add basic caching support
includes two implementations, a no-op NopCache and an in-memory MemoryCache.
This commit is contained in:
parent
a8fb3012bd
commit
95fdd8b79f
6 changed files with 167 additions and 12 deletions
|
|
@ -1,16 +1,26 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/willnorris/go-imageproxy/cache"
|
||||
"github.com/willnorris/go-imageproxy/proxy"
|
||||
)
|
||||
|
||||
var port = flag.Int("port", 8080, "port to listen on")
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
fmt.Printf("go-imageproxy listening on port %d\n", *port)
|
||||
|
||||
p := proxy.NewProxy(nil)
|
||||
p.Cache = cache.NewMemoryCache()
|
||||
server := &http.Server{
|
||||
Addr: ":8080",
|
||||
Addr: fmt.Sprintf(":%d", *port),
|
||||
Handler: p,
|
||||
}
|
||||
err := server.ListenAndServe()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue