简体   繁体   中英

Implement Caching in a network

I am developing an application which could be used in small networks where the external internet connectivity is slow.

My application will run on every host in that network and when I request a URL, it would search its own cache and caches of adjacent systems and if not found then search the external web. How should I go about implementing it? I have thought of something like:

  1. A port on every host to listen for caching requests
  2. An in-memory cache-table for every cached data
  3. Normal cache-search procedure

Any pointers to improve this architecture.

By all means develop your own cache, but it's probably worth looking at other very popular examples first. I would suggest taking a look at squid .

If you really want to build your own, you could think about using a distributed cache like ehcache . It replicates an entire copy of the cache to every node. In your case, you might only want to give ehcache information about URLs and which machine the data is stored on. That wouldn't limit you to adjacent systems.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM