Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace self.cache with self #506

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/flask_caching/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def decorated_function(*args, **kwargs):
rv = None
found = False
else:
rv = self.cache.get(cache_key)
rv = self.get(cache_key)
found = True

# If the value returned by cache.get() is None, it
Expand All @@ -393,7 +393,7 @@ def decorated_function(*args, **kwargs):
if not cache_none:
found = False
else:
found = self.cache.has(cache_key)
found = self.has(cache_key)
except Exception:
if self.app.debug:
raise
Expand All @@ -410,7 +410,7 @@ def decorated_function(*args, **kwargs):
if isinstance(rv, CachedResponse):
cache_timeout = rv.timeout or cache_timeout
try:
self.cache.set(
self.set(
cache_key,
rv,
timeout=cache_timeout,
Expand Down Expand Up @@ -540,10 +540,10 @@ def _memoize_version(
# Only delete the per-instance version key or per-function version
# key but not both.
if delete:
self.cache.delete_many(fetch_keys[-1])
self.delete_many(fetch_keys[-1])
return fname, None

version_data_list = list(self.cache.get_many(*fetch_keys))
version_data_list = list(self.get_many(*fetch_keys))
dirty = False

if (
Expand Down Expand Up @@ -574,7 +574,7 @@ def _memoize_version(
dirty = True

if dirty:
self.cache.set_many(
self.set_many(
dict(zip(fetch_keys, version_data_list)), timeout=timeout
)

Expand Down Expand Up @@ -850,7 +850,7 @@ def decorated_function(*args, **kwargs):
rv = None
found = False
else:
rv = self.cache.get(cache_key)
rv = self.get(cache_key)
found = True

# If the value returned by cache.get() is None, it
Expand All @@ -866,7 +866,7 @@ def decorated_function(*args, **kwargs):
if not cache_none:
found = False
else:
found = self.cache.has(cache_key)
found = self.has(cache_key)
except Exception:
if self.app.debug:
raise
Expand All @@ -880,7 +880,7 @@ def decorated_function(*args, **kwargs):

if response_filter is None or response_filter(rv):
try:
self.cache.set(
self.set(
cache_key,
rv,
timeout=decorated_function.cache_timeout,
Expand Down Expand Up @@ -1023,7 +1023,7 @@ def add(self, b):
self._memoize_version(f, reset=True)
else:
cache_key = f.make_cache_key(f.uncached, *args, **kwargs)
self.cache.delete(cache_key)
self.delete(cache_key)

def delete_memoized_verhash(self, f: Callable, *args) -> None:
"""Delete the version hash associated with the function.
Expand Down
Loading