πΈπΉπ A web cache that inter-operates with Firefox and dumps cached contents on disk.
- Consistent with the cache-control directives in the HTTP header field
- Able to serve multiple clients concurrently and has persistent state to recover from crashes or restarts
- Parses the HTML content from HTTP responses and rewrites URLs to content that it cached
- Caches and serves static web content retrieved by a browser using HTTP GETs
- Deletes cached items from both memory and disk once they expire
go run web-cache.go [ip1:port1] [ip2:port2] [replacement_policy] [cache_size] [expiration_time]
[ip1:port1]
: The TCP IP address and the port that the web cache will bind to to accept connections from clients.[ip2:port2]
: The TCP IP address and the port that the web cache should use when rewriting the HTML. For example, the web cache would rewrite<img src="http://foo.com/image.jpg"/>
to<img src="http://ip2:port2/URL"/>
[replacement_policy]
: The replacement policy (LRU
orLFU
) that the web cache follows during eviction.[cache_size]
: The capacity of the cache in MB (your cache cannot use more than this amount of capacity). Note that this specifies the (same) capacity for both the memory cache and the disk cache.[expiration_time]
: The time period in seconds after which an item in the cache is considered to be expired.
- The web cache code runs with Go 1.9.7
- Only uses standard library Go packages and the HTML library for parsing HTML in the web cache