aboutsummaryrefslogtreecommitdiff
path: root/files.moon
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-01-08 16:38:34 -0800
committerBruce Hill <bruce@bruce-hill.com>2019-01-08 16:38:45 -0800
commit1f47f1aa285a9c22af45995f53a3a1a11dc91ba3 (patch)
tree035237a0834c1af05e0dbe38be9c8b50b14fef65 /files.moon
parent1d2bd858fd7479bc672bc0e1be77f30c63f85b0c (diff)
Removed automatic file caching.
Diffstat (limited to 'files.moon')
-rw-r--r--files.moon10
1 files changed, 3 insertions, 7 deletions
diff --git a/files.moon b/files.moon
index 477e51e..b277120 100644
--- a/files.moon
+++ b/files.moon
@@ -10,7 +10,6 @@ run_cmd = (cmd)->
return lines
_SPOOFED_FILES = {}
-_FILE_CACHE = setmetatable {}, __index:_SPOOFED_FILES
_BROWSE_CACHE = {}
-- Create a fake file and put it in the cache
@@ -23,10 +22,9 @@ Files.spoof = (filename, contents)->
return filename
-- Read a file's contents
-Files.read = (filename, skip_cache=nil)->
- unless skip_cache
- if file_contents = _FILE_CACHE[filename]
- return file_contents or nil
+Files.read = (filename)->
+ if contents = _SPOOFED_FILES[filename]
+ return contents
if filename == 'stdin' or filename == '-'
contents = io.read('*a')
Files.spoof('stdin', contents)
@@ -36,8 +34,6 @@ Files.read = (filename, skip_cache=nil)->
return nil unless file
contents = file\read("*a")
file\close!
- unless skip_cache
- _FILE_CACHE[filename] = contents
return contents or nil
{:match, :gsub} = string