Data::Fallback@sf.net


Data::Fallback is a generic data caching system, that allows you to specify how to retrieve the data. It is object oriented perl, but using a simple fallback daemon, it is available to all languages that can speak TCP. There is a perldoc here.

fallback takes an array ref of hash refs, where each hash ref describes how to retrieve the data on its level. When information is requested, fallback goes to each level, tries to retrieve the information, and fallsback till it finds the information. Once the information is found, fallback walks back up the array, updating information where specified. By default, a Memory level is the zeroth level. This means that information that is very difficult to gather, can, after one hit, reside in memory. So instead of taking half a second or much more to gather, the information can be retrieved hundreds of times a second from a local daemon. I have retrieved information up to a thousand times a second, via the daemon on a local box.
Some examples. I just describe what the array of hash refs would look like below.
  1. Cache a remote database to a local conf file.
  2. [ { package => 'ConfFile', content => '/tmp/state_$primary_key', accept_update => 'group', }, { package => 'DBI', content => 'SELECT * FROM state WHERE id = ?', db => ["DBI:mysql:database=fallback;host=spack.net;port=7777", "fallback", ""], }, ],
  3. Look through a set of conf files in parallel directories.
  4. [ { package => 'ConfFile', content => '/tmp/dir1/state_$primary_key', }, { package => 'ConfFile', content => '/tmp/dir2/state_$primary_key', }, { package => 'ConfFile', content => '/tmp/dir3/state_$primary_key', }, ],
  5. Cache a page of your own creation
  6. [ { package => 'WholeFile', content => '/tmp/my_page', }, { package => 'MyOwn::Pacakge', }, ],
Really the possibilities are endless. Once I open source my HTTP document retrieval system (HTTP::Slap), I will write a Data::Fallback::Slap package which would allow for easy local caching of html pages or really anything you can get over the web. Similarly, Data::Fallback::FTP, or perhaps Data::Fallback::Soap could be written. Maybe even .net stuff (perish the thought).
Your thoughts or comments are welcome. If there is something you would like to help out with, please let me know.

Thanks,
Earl Cahill
my other open source projects
my other open source projects
SourceForge Logo