diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2019-01-08 16:38:34 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2019-01-08 16:38:45 -0800 |
| commit | 1f47f1aa285a9c22af45995f53a3a1a11dc91ba3 (patch) | |
| tree | 035237a0834c1af05e0dbe38be9c8b50b14fef65 /files.lua | |
| parent | 1d2bd858fd7479bc672bc0e1be77f30c63f85b0c (diff) | |
Removed automatic file caching.
Diffstat (limited to 'files.lua')
| -rw-r--r-- | files.lua | 21 |
1 files changed, 5 insertions, 16 deletions
@@ -20,9 +20,6 @@ run_cmd = function(cmd) return lines end local _SPOOFED_FILES = { } -local _FILE_CACHE = setmetatable({ }, { - __index = _SPOOFED_FILES -}) local _BROWSE_CACHE = { } local _anon_number = 0 Files.spoof = function(filename, contents) @@ -33,16 +30,11 @@ Files.spoof = function(filename, contents) _SPOOFED_FILES[filename] = contents return filename end -Files.read = function(filename, skip_cache) - if skip_cache == nil then - skip_cache = nil - end - if not (skip_cache) then - do - local file_contents = _FILE_CACHE[filename] - if file_contents then - return file_contents or nil - end +Files.read = function(filename) + do + local contents = _SPOOFED_FILES[filename] + if contents then + return contents end end if filename == 'stdin' or filename == '-' then @@ -57,9 +49,6 @@ Files.read = function(filename, skip_cache) end local contents = file:read("*a") file:close() - if not (skip_cache) then - _FILE_CACHE[filename] = contents - end return contents or nil end local match, gsub |
