[CC-ing the list, by permission from the author]

> Now the problem is that I do want to have a long term cache, but,
> I wouldn't like it to be on a file system (for various reasons, one
> being also efficiency).

>     So my idea was to download the source code, and see if I can
> somehow make polipo use a BerkeleyDb database instead of the file
> system.

I'd think about it twice.  Given a good underlying filesystem
(Reiserfs, XFS or a recent release of Ext3, if you happen to be
running Linux), it should beat any generic DB implementation hands on.

>     Thus my questions are:
>     0) Is it feasable to implement such a feature?

It's quite doable.

>     1) Would you ever implement a "pluggable" cache support? So that
> users can switch the backend? (Guess not :) )

No, I won't.  I couldn't possibly make sure I don't break such code in
the future.  Experience shows that people don't help much with testing,
so I'm not willing to include code that I don't regularly test myself.

>     2) Could you provide me with some documentation that would help me
> understand how such a feature would be implemented?

Sure.

An open on-disk file is represented with a DiskCacheEntry structure.
You need the following functions to be implemented:

  - makeDiskEntry, which opens an on-disk entry, checks whether it
    validates against an in-memory object, and if so, fills up the
    headers;
  - destroyDiskEntry, which closes such an entry; the second
    parameter specifies whhether to delete it;
  - objectFillFromDisk, which fills up part of an in-memory object
    from disk;
  - writeoutMetadata and writeoutToDisk, which write out in-memory
    data to disk.

There's also a second, more light-weidght data structure called
DiskObject, which is only used by the expiry process.

Hope this helps,

                                        Juliusz

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Polipo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/polipo-users

Reply via email to