namespace eval cache { # Dictionary containing filename and contents pairs. variable cache {}; proc hit {filename} { variable cache return [dict exists $cache $filename] } proc get {filename} { variable cache return [dict get $cache $filename] } proc add {filename} { variable cache set file [open $filename] fconfigure $file -translation binary dict append cache $filename [read $file] } proc remove {filename} { variable cache if [dict exists $cache $filename] { set cache [dict remove $cache $filename] } } # Process the precache foreach i $::http::configure::precache { add [string cat $::http::configure::srv $i] } }