modify ctime only when writing to file, prevents message "file has changed"
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 10 Oct 2004 19:33:23 +0000 (19:33 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 10 Oct 2004 19:33:23 +0000 (19:33 +0000)
git-svn-id: svn://svn.rot13.org/fuse_dbi/trunk@31 17f4e80c-d0e0-0310-8903-bfc3ae804c12

DBI.pm

diff --git a/DBI.pm b/DBI.pm
index 0374402..c94a5e3 100755 (executable)
--- a/DBI.pm
+++ b/DBI.pm
@@ -364,7 +364,8 @@ sub read_content {
 
        $sth->{'read'}->execute($id) || die $sth->{'read'}->errstr;
        $files{$file}{cont} = $sth->{'read'}->fetchrow_array;
-       $files{$file}{ctime} = time();
+       # I should modify ctime only if content in database changed
+       #$files{$file}{ctime} = time() unless ($files{$file}{ctime});
        print "file '$file' content [",length($files{$file}{cont})," bytes] read in cache\n";
 }
 
@@ -410,6 +411,7 @@ sub clear_cont {
        print "invalidate all cached content\n";
        foreach my $f (keys %files) {
                delete $files{$f}{cont};
+               delete $files{$f}{ctime};
        }
        print "begin new transaction\n";
        #$dbh->begin_work || die $dbh->errstr;