summaryrefslogtreecommitdiff
path: root/examples/dogpile_caching/caching_query.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/dogpile_caching/caching_query.py')
-rw-r--r--examples/dogpile_caching/caching_query.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/dogpile_caching/caching_query.py b/examples/dogpile_caching/caching_query.py
index dc007a760..4533dce00 100644
--- a/examples/dogpile_caching/caching_query.py
+++ b/examples/dogpile_caching/caching_query.py
@@ -130,10 +130,19 @@ class FromCache(UserDefinedOption):
self.expiration_time = expiration_time
self.ignore_expiration = ignore_expiration
+ # this is not needed as of SQLAlchemy 1.4.28;
+ # UserDefinedOption classes no longer participate in the SQL
+ # compilation cache key
def _gen_cache_key(self, anon_map, bindparams):
return None
def _generate_cache_key(self, statement, parameters, orm_cache):
+ """generate a cache key with which to key the results of a statement.
+
+ This leverages the use of the SQL compilation cache key which is
+ repurposed as a SQL results key.
+
+ """
statement_cache_key = statement._generate_cache_key()
key = statement_cache_key.to_offline_string(