Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
d6b3ea75
Commit
d6b3ea75
authored
10 years ago
by
Paul "LeoNerd" Evans
Browse files
Options
Downloads
Patches
Plain Diff
Implement the 'key in dict' test for LruCache()
parent
7ab9f91a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/util/lrucache.py
+7
-0
7 additions, 0 deletions
synapse/util/lrucache.py
with
7 additions
and
0 deletions
synapse/util/lrucache.py
+
7
−
0
View file @
d6b3ea75
...
...
@@ -90,12 +90,16 @@ class LruCache(object):
def
cache_len
():
return
len
(
cache
)
def
cache_contains
(
key
):
return
key
in
cache
self
.
sentinel
=
object
()
self
.
get
=
cache_get
self
.
set
=
cache_set
self
.
setdefault
=
cache_set_default
self
.
pop
=
cache_pop
self
.
len
=
cache_len
self
.
contains
=
cache_contains
def
__getitem__
(
self
,
key
):
result
=
self
.
get
(
key
,
self
.
sentinel
)
...
...
@@ -114,3 +118,6 @@ class LruCache(object):
def
__len__
(
self
):
return
self
.
len
()
def
__contains__
(
self
,
key
):
return
self
.
contains
(
key
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment