Skip to content

ProxyCache is a CLI tool that starts a caching proxy server, forwarding requests to an origin server and caching the responses. It improves response times by serving cached content for repeated requests, with options to clear the cache when needed.

Notifications You must be signed in to change notification settings

waltertaya/ProxyCache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Caching Proxy

Build a caching server that caches responses from other servers.

CLI tool that starts a caching proxy server, it will forward requests to the actual server and cache the responses. If the same request is made again, it will return the cached response instead of forwarding the request to the server.

Project challenge from source

Requirements

User should be able to start the caching proxy server by running a command like following:

caching-proxy --port <number> --origin <url>
  • --port is the port on which the caching proxy server will run.
  • --origin is the URL of the server to which the requests will be forwarded.

For example, if the user runs the following command:

caching-proxy --port 3000 --origin https://dummyjson.com

The caching proxy server should start on port 3000 and forward requests to https://dummyjson.com.

Taking the above example, if the user makes a request to http://localhost:3000/products, the caching proxy server should forward the request to http://dummyjson.com/products, return the response along with headers and cache the response. Also, add the headers to the response that indicate whether the response is from the cache or the server.

# If the response is from the cache
X-Cache: HIT

# If the response is from the origin server
X-Cache: MISS

If the same request is made again, the caching proxy server should return the cached response instead of forwarding the request to the server.

Also provide a way to clear the cache by running a command like following:

caching-proxy --clear-cache

Author

About

ProxyCache is a CLI tool that starts a caching proxy server, forwarding requests to an origin server and caching the responses. It improves response times by serving cached content for repeated requests, with options to clear the cache when needed.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages