Delete FileCache in favor of simple dict

This commit is contained in:
Scoder12
2020-07-28 17:38:35 -07:00
parent b67d1d4e27
commit 5cba0a7517
+1 -44
View File
@@ -2,50 +2,7 @@
import flask
class FileCache:
"""A simple cache for files."""
def __init__(self) -> None:
"""Initialize the class."""
self.data = {}
def add_to_cache(self, filename: str, content: str) -> None:
"""Add a filename to the cache.
Args:
filename (str): The filename to add.
content (str): The content to add to the cache.
"""
self.data[filename] = content
def has(self, filename: str) -> bool:
"""Whether the cache has a certain filename.
Args:
filename (str): The filename to check for.
Returns:
bool: Whether the cache has filename.
"""
return filename in self.data
def invalidate(self, filename: str) -> None:
"""Remove a filename from the cache.
Args:
filename (str): The filename to remove.
"""
try:
self.data.pop(filename)
except KeyError:
pass
def flush(self) -> None:
"""Remove all values from the cache."""
self.data = {}
cache = FileCache()
cache = {}
class File(flask.Response):