[system] / trunk / pg / lib / WeBWorK / EquationCache.pm Repository:
ViewVC logotype

Diff of /trunk/pg/lib/WeBWorK/EquationCache.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1524 Revision 2409
49Returns a new EquationCache object. C<%options> must contain the following 49Returns a new EquationCache object. C<%options> must contain the following
50entries: 50entries:
51 51
52 cacheDB => path to image cache database file 52 cacheDB => path to image cache database file
53 53
54If cacheDB is the empty string, don't use a cache file and assume that there
55are no md5 collisions.
56
54=cut 57=cut
55 58
56sub new { 59sub new {
57 my ($invocant, %options) = @_; 60 my ($invocant, %options) = @_;
58 my $class = ref $invocant || $invocant; 61 my $class = ref $invocant || $invocant;
74 my ($self, $tex) = @_; 77 my ($self, $tex) = @_;
75 $tex =~ s/\s+//g; 78 $tex =~ s/\s+//g;
76 my $md5 = md5_hex($tex); 79 my $md5 = md5_hex($tex);
77 80
78 my $db = $self->{cacheDB}; 81 my $db = $self->{cacheDB};
82 unless($db) { return($md5 ."1"); }
79 sysopen(DB, $db, O_RDWR|O_CREAT) 83 sysopen(DB, $db, O_RDWR|O_CREAT)
80 or die "failed to create/open cacheDB $db: $!"; 84 or die "failed to create/open cacheDB $db: $!";
81 flock(DB, LOCK_EX) 85 flock(DB, LOCK_EX)
82 or die "failed to write-lock cacheDB $db: $!"; 86 or die "failed to write-lock cacheDB $db: $!";
83 87

Legend:
Removed from v.1524  
changed lines
  Added in v.2409

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9