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

Ensure that ActiveContextCache only enters a given combination of (activeCtx, localCtx) once in its internal FIFO #44

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
7 changes: 6 additions & 1 deletion lib/pyld/jsonld.py
Original file line number Diff line number Diff line change
Expand Up @@ -5089,7 +5089,12 @@ def set(self, active_ctx, local_ctx, result):
del self.cache[entry['activeCtx']][entry['localCtx']]
key1 = json.dumps(active_ctx)
key2 = json.dumps(local_ctx)
self.order.append({'activeCtx': key1, 'localCtx': key2})
# if we haven't seen this key combination before, add it to the deque.
# (if it already exists -- i.e., if we're overwriting an existing
# value -- then it's already contained in the deque, and we shouldn't
# do anything)
if key1 not in self.cache or key2 not in self.cache[key1]:
self.order.append({'activeCtx': key1, 'localCtx': key2})
self.cache.setdefault(key1, {})[key2] = json.loads(json.dumps(result))


Expand Down