views:

26

answers:

1

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.

+1  A: 

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.

John