Mail Index

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ApacheGallery] treating hardlinked files efficiently?

On Sat, 23 Jun 2007, KORN Andras wrote:
> Maybe the cache directory could be reorganized to store resized
> versions based on the md5sum (or even just the inode number) of the
> original image? This would do away with the redundancy.

An md5sum is rather expensive to calculate, and inode numbers are
filesystem specific, and mean that transfers to a different system are
extreemly painful.

In the cases where you'd do a complex setup of virtual directories,
the best way is to use symlinks, and have A::G readlink the file and
map to the resultant cache directory at the stage where it is building
the main templates.

Something along the lines of replacing 

my @files = grep { !/^\./ && -f "$filename/$_" } readdir (DIR);


my @files = map {-l $_ ? readlink($_): $_ } grep { !/^\./ && -f "$filename/$_" } readdir (DIR);

[The above is wrong, because it doesn't deal with absolute links and
assumes that the filesystem matches the apache directory tree, but you
get the idea.]

Don Armstrong

If a nation values anything more than freedom, it will lose its
freedom; and the irony of it is that if it is comfort or money it
values more, it will lose that, too.
 -- W. Somerset Maugham    
users mailing list
[email protected]