DBD-PgLite
view release on metacpan or search on metacpan
lib/DBD/PgLite/MirrorPgToSQLite.pm view on Meta::CPAN
return ($create, $colcnt);
}
sub cached_schema {
my ($sn,$tn,$creat,$cnt,%opt) = @_;
my $database = $opt{pg_dbh}->{mbl_dbh}
? $opt{pg_dbh}->{mbl_dbh}->[0]->{Name}
: $opt{pg_dbh}->{Name};
unless (-d $opt{cachedir}) {
mkdir $opt{cachedir};
chmod 0777, $opt{cachedir};
}
my $uid = (getpwuid($>))[0] || $>;
mkdir "$opt{cachedir}/$uid" unless -d "$opt{cachedir}/$uid";
my $fn = "$opt{cachedir}/$uid/$database.$sn.$tn";
if ($cnt) {
Storable::store [$creat,$cnt], $fn;
} elsif (-f $fn && time-(stat $fn)[9]<7*24*60*60) {
my $ret = Storable::retrieve $fn || [];
return @$ret;
} else {
( run in 0.299 second using v1.01-cache-2.11-cpan-496ff517765 )